Class: Flagmoji::Country

Inherits:
Object
  • Object
show all
Defined in:
lib/flagmoji/country.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/flagmoji/country.rb', line 3

def code
  @code
end

#emojiObject (readonly)

Returns the value of attribute emoji.



3
4
5
# File 'lib/flagmoji/country.rb', line 3

def emoji
  @emoji
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/flagmoji/country.rb', line 3

def name
  @name
end

#unicodeObject (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

.nullObject



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