Class: Anystyle::Parser::Feature
- Inherits:
-
Object
- Object
- Anystyle::Parser::Feature
- Defined in:
- lib/anystyle/parser/features.rb
Class Attribute Summary collapse
-
.dict ⇒ Object
readonly
Returns the value of attribute dict.
-
.instances ⇒ Object
readonly
Returns the value of attribute instances.
Instance Attribute Summary collapse
-
#matcher ⇒ Object
Returns the value of attribute matcher.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, matcher) ⇒ Feature
constructor
A new instance of Feature.
- #match(*arguments) ⇒ Object
Constructor Details
#initialize(name, matcher) ⇒ Feature
Returns a new instance of Feature.
27 28 29 |
# File 'lib/anystyle/parser/features.rb', line 27 def initialize(name, matcher) @name, @matcher = name, matcher end |
Class Attribute Details
.dict ⇒ Object (readonly)
Returns the value of attribute dict.
13 14 15 |
# File 'lib/anystyle/parser/features.rb', line 13 def dict @dict end |
.instances ⇒ Object (readonly)
Returns the value of attribute instances.
13 14 15 |
# File 'lib/anystyle/parser/features.rb', line 13 def instances @instances end |
Instance Attribute Details
#matcher ⇒ Object
Returns the value of attribute matcher.
25 26 27 |
# File 'lib/anystyle/parser/features.rb', line 25 def matcher @matcher end |
#name ⇒ Object
Returns the value of attribute name.
25 26 27 |
# File 'lib/anystyle/parser/features.rb', line 25 def name @name end |
Class Method Details
.define(name, &block) ⇒ Object
15 16 17 |
# File 'lib/anystyle/parser/features.rb', line 15 def define(name, &block) instances << new(name, block) end |
.undefine(name) ⇒ Object
19 20 21 |
# File 'lib/anystyle/parser/features.rb', line 19 def undefine(name) instances.reject! { |f| f.name == name } end |
Instance Method Details
#match(*arguments) ⇒ Object
31 32 33 |
# File 'lib/anystyle/parser/features.rb', line 31 def match(*arguments) matcher.call(*arguments) end |