Class: Versionub::Type::Instance
- Inherits:
-
Object
- Object
- Versionub::Type::Instance
- Defined in:
- lib/versionub/type.rb
Class Attribute Summary collapse
-
.parser ⇒ Object
Returns the value of attribute parser.
-
.transformer ⇒ Object
Returns the value of attribute transformer.
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, text, data) ⇒ Instance
constructor
A new instance of Instance.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(type, text, data) ⇒ Instance
Returns a new instance of Instance.
28 29 30 31 32 |
# File 'lib/versionub/type.rb', line 28 def initialize (type, text, data) @type = type @text = text @data = data end |
Class Attribute Details
.parser ⇒ Object
Returns the value of attribute parser.
43 44 45 |
# File 'lib/versionub/type.rb', line 43 def parser @parser end |
.transformer ⇒ Object
Returns the value of attribute transformer.
43 44 45 |
# File 'lib/versionub/type.rb', line 43 def transformer @transformer end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
26 27 28 |
# File 'lib/versionub/type.rb', line 26 def type @type end |
Class Method Details
.parse(&block) ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/versionub/type.rb', line 45 def parse (&block) if block @parser = Class.new(Parslet::Parser) @parser.class_eval(&block) end @parser end |
.transform(&block) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/versionub/type.rb', line 54 def transform (&block) if block @transformer = Class.new(Parslet::Transform) @transformer.class_eval(&block) end @transformer end |
Instance Method Details
#to_hash ⇒ Object
34 35 36 |
# File 'lib/versionub/type.rb', line 34 def to_hash @data.clone end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/versionub/type.rb', line 38 def to_s @text end |