Class: PatternRuby::Entity
- Inherits:
-
Object
- Object
- PatternRuby::Entity
- Defined in:
- lib/pattern_ruby/entity.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#span ⇒ Object
readonly
Returns the value of attribute span.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name:, type: :string, value: nil, raw: nil, span: nil) ⇒ Entity
constructor
A new instance of Entity.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, type: :string, value: nil, raw: nil, span: nil) ⇒ Entity
Returns a new instance of Entity.
5 6 7 8 9 10 11 |
# File 'lib/pattern_ruby/entity.rb', line 5 def initialize(name:, type: :string, value: nil, raw: nil, span: nil) @name = name.to_sym @type = type.to_sym @value = value @raw = raw @span = span end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/pattern_ruby/entity.rb', line 3 def name @name end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
3 4 5 |
# File 'lib/pattern_ruby/entity.rb', line 3 def raw @raw end |
#span ⇒ Object (readonly)
Returns the value of attribute span.
3 4 5 |
# File 'lib/pattern_ruby/entity.rb', line 3 def span @span end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/pattern_ruby/entity.rb', line 3 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/pattern_ruby/entity.rb', line 3 def value @value end |
Instance Method Details
#to_h ⇒ Object
13 14 15 |
# File 'lib/pattern_ruby/entity.rb', line 13 def to_h { name: @name, type: @type, value: @value, raw: @raw } end |