Class: DataBase
- Inherits:
-
Object
- Object
- DataBase
- Defined in:
- lib/emoji/data/data_base.rb
Constant Summary collapse
- DATA_REGEXP =
Format: codepoint(s) ; property=Yes # [count] (character(s)) name
%r{ (?<codepoints>.+); \s{1} (?<property>(Emoji_Modifier_Base|Emoji_Presentation|Emoji_Modifier|Emoji)) \s+ \# \s+ \[ (?<count>\d+) \] \s{1} \((?<characters>.+)\) \s+ (?<name>.+) }x.freeze
Instance Attribute Summary collapse
-
#characters ⇒ Object
readonly
Returns the value of attribute characters.
-
#codepoints ⇒ Object
readonly
Returns the value of attribute codepoints.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#property ⇒ Object
readonly
Returns the value of attribute property.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#initialize(raw) ⇒ DataBase
constructor
A new instance of DataBase.
- #to_h ⇒ Object
Constructor Details
#initialize(raw) ⇒ DataBase
Returns a new instance of DataBase.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/emoji/data/data_base.rb', line 22 def initialize(raw) @raw = raw matched = raw.match(DATA_REGEXP) @codepoints = matched[:codepoints].rstrip @property = matched[:property] @count = matched[:count] @characters = matched[:characters] @name = matched[:name] end |
Instance Attribute Details
#characters ⇒ Object (readonly)
Returns the value of attribute characters.
20 21 22 |
# File 'lib/emoji/data/data_base.rb', line 20 def characters @characters end |
#codepoints ⇒ Object (readonly)
Returns the value of attribute codepoints.
20 21 22 |
# File 'lib/emoji/data/data_base.rb', line 20 def codepoints @codepoints end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
20 21 22 |
# File 'lib/emoji/data/data_base.rb', line 20 def count @count end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
20 21 22 |
# File 'lib/emoji/data/data_base.rb', line 20 def name @name end |
#property ⇒ Object (readonly)
Returns the value of attribute property.
20 21 22 |
# File 'lib/emoji/data/data_base.rb', line 20 def property @property end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
20 21 22 |
# File 'lib/emoji/data/data_base.rb', line 20 def raw @raw end |
Instance Method Details
#to_h ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/emoji/data/data_base.rb', line 33 def to_h Hash( codepoints: codepoints, property: property, count: count, characters: characters, name: name ) end |