Class: GettextSwap::Configuration
- Inherits:
-
Object
- Object
- GettextSwap::Configuration
- Defined in:
- lib/gettext_swap/configuration.rb
Instance Attribute Summary collapse
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #read_yaml(yaml) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 |
# File 'lib/gettext_swap/configuration.rb', line 7 def initialize @rules = [] end |
Instance Attribute Details
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
5 6 7 |
# File 'lib/gettext_swap/configuration.rb', line 5 def rules @rules end |
Instance Method Details
#read_yaml(yaml) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gettext_swap/configuration.rb', line 11 def read_yaml(yaml) root = yaml['swap'] raise( GettextSwap::Exception, "root 'swap' element must be specified") unless root # Be atomic, either load the whole file, or don't load it at all tuples = root.map { |tuple| read_tuple(tuple) } @rules = tuples.freeze true end |