Flowdock
method

=~

Importance_1
v5.2.3 - Show latest stable - 0 notes - Class: ActiveModel::Name
=~ public

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
Show source
Register or log in to add new notes.