Class: Flagmoji::Country
- Inherits:
-
Object
- Object
- Flagmoji::Country
- Defined in:
- lib/flagmoji/country.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#emoji ⇒ Object
readonly
Returns the value of attribute emoji.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#unicode ⇒ Object
readonly
Returns the value of attribute unicode.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code:, name:, unicode:, emoji:) ⇒ Country
constructor
A new instance of Country.
Constructor Details
#initialize(code:, name:, unicode:, emoji:) ⇒ Country
Returns a new instance of Country.
5 6 7 8 9 10 |
# File 'lib/flagmoji/country.rb', line 5 def initialize(code:, name:, unicode:, emoji:) @code = code @name = name @unicode = unicode @emoji = emoji end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
3 4 5 |
# File 'lib/flagmoji/country.rb', line 3 def code @code end |
#emoji ⇒ Object (readonly)
Returns the value of attribute emoji.
3 4 5 |
# File 'lib/flagmoji/country.rb', line 3 def emoji @emoji end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/flagmoji/country.rb', line 3 def name @name end |
#unicode ⇒ Object (readonly)
Returns the value of attribute unicode.
3 4 5 |
# File 'lib/flagmoji/country.rb', line 3 def unicode @unicode end |
Class Method Details
.from_data(data) ⇒ Object
12 13 14 |
# File 'lib/flagmoji/country.rb', line 12 def self.from_data(data) new(data.transform_keys(&:to_sym)) end |
.null ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/flagmoji/country.rb', line 16 def self.null new( code: "N/A", name: "Country missing", unicode: "", emoji: "" ) end |