Sha256: 943a3ef38e2a3180a0e9b368123f33525dce48fc0c1685f98f4f5f8c07baac47
Contents?: true
Size: 679 Bytes
Versions: 46
Compression:
Stored size: 679 Bytes
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Tokenizers class Token attr_accessor :value, :type def initialize(options = {}) options.each_pair do |key, val| self.send("#{key.to_s}=", val) end end def to_hash { value: @value, type: @type } end def to_s @value end # overriding `to_s` also overrides `inspect`, so we have to redefine it manually def inspect "<#{self.class}: #{instance_variables.map {|v| "#{v}=#{instance_variable_get(v).inspect}" }.join(", ")}>" end end end end
Version data entries
46 entries across 46 versions & 2 rubygems