Class: Markie::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/markie/token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/markie/token.rb', line 3

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/markie/token.rb', line 3

def value
  @value
end

Instance Method Details

#lengthObject



10
11
12
# File 'lib/markie/token.rb', line 10

def length
  value.length
end

#to_sObject



14
15
16
# File 'lib/markie/token.rb', line 14

def to_s
  "{ type: #{type}, value: \"#{value}\" }"
end