Class: TwitterCldr::Tokenizers::Token
- Inherits:
-
Object
- Object
- TwitterCldr::Tokenizers::Token
- Defined in:
- lib/twitter_cldr/tokenizers/token.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Token
constructor
A new instance of Token.
-
#inspect ⇒ Object
overriding ‘to_s` also overrides `inspect`, so we have to redefine it manually.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Token
Returns a new instance of Token.
11 12 13 14 15 |
# File 'lib/twitter_cldr/tokenizers/token.rb', line 11 def initialize( = {}) .each_pair do |key, val| self.send("#{key.to_s}=", val) end end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
9 10 11 |
# File 'lib/twitter_cldr/tokenizers/token.rb', line 9 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
9 10 11 |
# File 'lib/twitter_cldr/tokenizers/token.rb', line 9 def value @value end |
Instance Method Details
#inspect ⇒ Object
overriding ‘to_s` also overrides `inspect`, so we have to redefine it manually
26 27 28 |
# File 'lib/twitter_cldr/tokenizers/token.rb', line 26 def inspect "<#{self.class}: #{instance_variables.map {|v| "#{v}=#{instance_variable_get(v).inspect}" }.join(", ")}>" end |
#to_hash ⇒ Object
17 18 19 |
# File 'lib/twitter_cldr/tokenizers/token.rb', line 17 def to_hash { value: @value, type: @type } end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/twitter_cldr/tokenizers/token.rb', line 21 def to_s @value end |