Module: Hopsoft::ActsAsLookup::IsLookup::InstanceMethods
- Defined in:
- lib/hopsoft/acts_as_lookup.rb
Overview
Add instance methods here
Instance Method Summary collapse
Instance Method Details
#==(value) ⇒ Object
203 204 205 206 207 208 |
# File 'lib/hopsoft/acts_as_lookup.rb', line 203 def ==(value) return name == value if value.is_a?(String) return name == value.to_s if value.is_a?(Symbol) return id == value.id if self.class == value.class return self.object_id == value.object_id end |
#=~(value) ⇒ Object
210 211 212 213 214 215 |
# File 'lib/hopsoft/acts_as_lookup.rb', line 210 def =~(value) return name =~ value if value.is_a?(Regexp) return name =~ /#{value}/i if value.is_a?(String) return name =~ /#{value.to_s}/i if value.is_a?(Symbol) return false end |
#to_s ⇒ Object
199 200 201 |
# File 'lib/hopsoft/acts_as_lookup.rb', line 199 def to_s return name end |