Class: Markie::Token
- Inherits:
-
Object
- Object
- Markie::Token
- Defined in:
- lib/markie/token.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(type:, value: "") ⇒ Token
constructor
A new instance of Token.
- #length ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(type:, value: "") ⇒ Token
5 6 7 8 |
# File 'lib/markie/token.rb', line 5 def initialize(type:, value: "") @type = type @value = value end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/markie/token.rb', line 3 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/markie/token.rb', line 3 def value @value end |
Instance Method Details
#length ⇒ Object
10 11 12 |
# File 'lib/markie/token.rb', line 10 def length value.length end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/markie/token.rb', line 14 def to_s "{ type: #{type}, value: \"#{value}\" }" end |