Class: Leadlight::TypeMap::Mapping
- Inherits:
-
Object
- Object
- Leadlight::TypeMap::Mapping
- Extended by:
- Forwardable
- Defined in:
- lib/leadlight/type_map.rb
Instance Method Summary collapse
-
#initialize(enctype_pattern, object_pattern, type) ⇒ Mapping
constructor
A new instance of Mapping.
- #match_for_enctype?(enctype) ⇒ Boolean
- #match_for_object?(object) ⇒ Boolean
Constructor Details
#initialize(enctype_pattern, object_pattern, type) ⇒ Mapping
Returns a new instance of Mapping.
64 65 66 67 68 |
# File 'lib/leadlight/type_map.rb', line 64 def initialize(enctype_pattern, object_pattern, type) enctype_patterns Array(enctype_pattern) object_patterns Array(object_pattern) self.type = type end |
Instance Method Details
#match_for_enctype?(enctype) ⇒ Boolean
70 71 72 |
# File 'lib/leadlight/type_map.rb', line 70 def match_for_enctype?(enctype) enctype_patterns.any?{|p| p === enctype} end |
#match_for_object?(object) ⇒ Boolean
74 75 76 |
# File 'lib/leadlight/type_map.rb', line 74 def match_for_object?(object) object_patterns.any?{|p| p === object} end |