Class: SimpleMapper::Attribute::Pattern
- Inherits:
-
SimpleMapper::Attribute
- Object
- SimpleMapper::Attribute
- SimpleMapper::Attribute::Pattern
- Includes:
- Collection
- Defined in:
- lib/simple_mapper/attribute/pattern.rb
Constant Summary
Constants inherited from SimpleMapper::Attribute
Instance Attribute Summary collapse
-
#pattern ⇒ Object
Returns the value of attribute pattern.
Attributes inherited from SimpleMapper::Attribute
#default, #key, #mapper, #name
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Pattern
constructor
A new instance of Pattern.
- #member_key?(key) ⇒ Boolean
Methods included from Collection
#apply_type, #changed?, #freeze_for, #from_simple_key, #new_collection, #source_value, #to_simple, #to_simple_key, #transformed_source_value
Methods inherited from SimpleMapper::Attribute
#change_tracking_for, #changed!, #changed?, #converter, #default_value, #encode, #freeze_for, #process_options, #source_value, #to_simple, #transformed_source_value, #type, #type=, #value
Constructor Details
#initialize(name, options = {}) ⇒ Pattern
Returns a new instance of Pattern.
6 7 8 9 |
# File 'lib/simple_mapper/attribute/pattern.rb', line 6 def initialize(name, = {}) super(name, ) self.pattern = [:pattern] end |
Instance Attribute Details
#pattern ⇒ Object
Returns the value of attribute pattern.
4 5 6 |
# File 'lib/simple_mapper/attribute/pattern.rb', line 4 def pattern @pattern end |
Instance Method Details
#member_key?(key) ⇒ Boolean
16 17 18 |
# File 'lib/simple_mapper/attribute/pattern.rb', line 16 def member_key?(key) (pattern.match(key.to_s) and true) or false end |