instance method
=~
Ruby on Rails edge
Since v4.0.13Signature
=~(regexp)
Equivalent to ‘String#=~`. Match the class name against the given regexp. Returns the position where the match starts or nil if there is no match.
“‘ class BlogPost
extend ActiveModel::Naming
end
BlogPost.model_name =~ /Post/ # => 4 BlogPost.model_name =~ /\d/ # => nil “‘
Source
# File activemodel/lib/active_model/naming.rb, line 71
Defined in activemodel/lib/active_model/naming.rb line 71
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Name