Class: ISO::Tag
- Inherits:
-
Object
- Object
- ISO::Tag
- Defined in:
- lib/iso/tag.rb
Instance Attribute Summary collapse
-
#language ⇒ Object
Returns the value of attribute language.
-
#region ⇒ Object
Returns the value of attribute region.
Instance Method Summary collapse
- #codes ⇒ Object
-
#initialize(code) ⇒ Tag
constructor
A new instance of Tag.
- #subtags ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
Instance Attribute Details
#language ⇒ Object
Returns the value of attribute language.
3 4 5 |
# File 'lib/iso/tag.rb', line 3 def language @language end |
#region ⇒ Object
Returns the value of attribute region.
3 4 5 |
# File 'lib/iso/tag.rb', line 3 def region @region end |
Instance Method Details
#codes ⇒ Object
11 12 13 |
# File 'lib/iso/tag.rb', line 11 def codes .map(&:code) end |
#subtags ⇒ Object
15 16 17 |
# File 'lib/iso/tag.rb', line 15 def [language, region].compact end |
#valid? ⇒ Boolean
19 20 21 22 |
# File 'lib/iso/tag.rb', line 19 def valid? return false if @language.nil? @code.split('-').size == .size end |