Module: Weight::Configuration
- Included in:
- Weight
- Defined in:
- lib/weight/configuration.rb
Class Method Summary collapse
- .allowed_units ⇒ Object
- .configure {|_self| ... } ⇒ Object
- .default_unit ⇒ Object
- .default_unit=(weight_unit_code) ⇒ Object
- .round_level ⇒ Object
Class Method Details
.allowed_units ⇒ Object
22 23 24 |
# File 'lib/weight/configuration.rb', line 22 def allowed_units [:kg, :lb] end |
.configure {|_self| ... } ⇒ Object
4 5 6 |
# File 'lib/weight/configuration.rb', line 4 def self.configure yield self if block_given? end |
.default_unit ⇒ Object
14 15 16 |
# File 'lib/weight/configuration.rb', line 14 def default_unit @@default_unit ||= :kg end |
.default_unit=(weight_unit_code) ⇒ Object
8 9 10 11 12 |
# File 'lib/weight/configuration.rb', line 8 def default_unit=(weight_unit_code) default_unit = weight_unit_code.to_s.downcase.to_sym raise ArgumentError unless allowed_units.include?(default_unit) @@default_unit = default_unit end |
.round_level ⇒ Object
18 19 20 |
# File 'lib/weight/configuration.rb', line 18 def round_level @round_level ||= 4 end |