Class: Transform
- Inherits:
-
Object
- Object
- Transform
- Defined in:
- lib/pertinent_parser/transform.rb
Instance Attribute Summary collapse
-
#property ⇒ Object
Returns the value of attribute property.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #apply(s) ⇒ Object
-
#initialize(type, property) ⇒ Transform
constructor
A new instance of Transform.
- #split(n) ⇒ Object
Constructor Details
#initialize(type, property) ⇒ Transform
Returns a new instance of Transform.
4 5 6 |
# File 'lib/pertinent_parser/transform.rb', line 4 def initialize type, property @type, @property = type, property end |
Instance Attribute Details
#property ⇒ Object
Returns the value of attribute property.
2 3 4 |
# File 'lib/pertinent_parser/transform.rb', line 2 def property @property end |
#type ⇒ Object
Returns the value of attribute type.
2 3 4 |
# File 'lib/pertinent_parser/transform.rb', line 2 def type @type end |
Instance Method Details
#apply(s) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/pertinent_parser/transform.rb', line 16 def apply(s) if @type == :identity return s elsif @type == :replacement return @property elsif @type == :wrap return @property[0] + s + @property[1] end end |