Class: TwitterKorean::KoreanToken::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_korean/korean_token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Metadata

Returns a new instance of Metadata.



25
26
27
28
# File 'lib/twitter_korean/korean_token.rb', line 25

def initialize(attrs = {})
  attrs.each { |k, v| send("#{k}=", v) if respond_to?("#{k}=") }
  symbolize_pos!
end

Instance Attribute Details

#lengthObject

Returns the value of attribute length.



23
24
25
# File 'lib/twitter_korean/korean_token.rb', line 23

def length
  @length
end

#offsetObject

Returns the value of attribute offset.



23
24
25
# File 'lib/twitter_korean/korean_token.rb', line 23

def offset
  @offset
end

#posObject

Returns the value of attribute pos.



23
24
25
# File 'lib/twitter_korean/korean_token.rb', line 23

def pos
  @pos
end

#unkownObject

Returns the value of attribute unkown.



23
24
25
# File 'lib/twitter_korean/korean_token.rb', line 23

def unkown
  @unkown
end

Instance Method Details

#==(other) ⇒ Object



34
35
36
# File 'lib/twitter_korean/korean_token.rb', line 34

def ==(other)
  [:pos, :offset, :length, :unkown].inject(true) { |res, attr| res && (send(attr) == other.send(attr)) }
end

#inspectObject



30
31
32
# File 'lib/twitter_korean/korean_token.rb', line 30

def inspect
  "#{pos}, #{offset}, #{length}"
end