Class: Masklen::Locale
- Inherits:
-
Struct
- Object
- Struct
- Masklen::Locale
- Defined in:
- lib/masklen/types.rb
Overview
Locale and regional data for an IP address.
Instance Attribute Summary collapse
-
#calling_code ⇒ Object
Returns the value of attribute calling_code.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#currency_symbol ⇒ Object
Returns the value of attribute currency_symbol.
-
#flag ⇒ Object
Returns the value of attribute flag.
-
#languages ⇒ Object
Returns the value of attribute languages.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Build a Locale from a parsed JSON hash.
Instance Attribute Details
#calling_code ⇒ Object
Returns the value of attribute calling_code
78 79 80 |
# File 'lib/masklen/types.rb', line 78 def calling_code @calling_code end |
#currency ⇒ Object
Returns the value of attribute currency
78 79 80 |
# File 'lib/masklen/types.rb', line 78 def currency @currency end |
#currency_symbol ⇒ Object
Returns the value of attribute currency_symbol
78 79 80 |
# File 'lib/masklen/types.rb', line 78 def currency_symbol @currency_symbol end |
#flag ⇒ Object
Returns the value of attribute flag
78 79 80 |
# File 'lib/masklen/types.rb', line 78 def flag @flag end |
#languages ⇒ Object
Returns the value of attribute languages
78 79 80 |
# File 'lib/masklen/types.rb', line 78 def languages @languages end |
Class Method Details
.from_hash(hash) ⇒ Object
Build a Locale from a parsed JSON hash. Returns nil if hash is nil.
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/masklen/types.rb', line 87 def self.from_hash(hash) return nil if hash.nil? new( currency: hash["currency"], currency_symbol: hash["currency_symbol"], calling_code: hash["calling_code"], languages: hash["languages"] || [], flag: hash["flag"] ) end |