Class: TwitterCldr::Segmentation::CategoryTable
- Inherits:
-
Object
- Object
- TwitterCldr::Segmentation::CategoryTable
- Defined in:
- lib/twitter_cldr/segmentation/category_table.rb
Constant Summary collapse
- PACK_FMT_16 =
'NNn'.freeze
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Class Method Summary collapse
Instance Method Summary collapse
- #dump16 ⇒ Object
- #get(codepoint) ⇒ Object
-
#initialize(values) ⇒ CategoryTable
constructor
A new instance of CategoryTable.
Constructor Details
#initialize(values) ⇒ CategoryTable
Returns a new instance of CategoryTable.
27 28 29 |
# File 'lib/twitter_cldr/segmentation/category_table.rb', line 27 def initialize(values) @values = values end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
25 26 27 |
# File 'lib/twitter_cldr/segmentation/category_table.rb', line 25 def values @values end |
Class Method Details
.load16(data) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/twitter_cldr/segmentation/category_table.rb', line 14 def load16(data) data = Base64.decode64(data) new( (0...data.size).step(10).map do |i| data[i...(i + 10)].unpack(PACK_FMT_16) end ) end |
Instance Method Details
#dump16 ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/twitter_cldr/segmentation/category_table.rb', line 35 def dump16 data = ''.b.tap do |result| values.each do |vals| result << vals.pack(PACK_FMT_16) end end Base64.encode64(data) end |
#get(codepoint) ⇒ Object
31 32 33 |
# File 'lib/twitter_cldr/segmentation/category_table.rb', line 31 def get(codepoint) find(codepoint)[2] end |