Class: Quantify::Unit::Prefix::Base
- Inherits:
-
Object
- Object
- Quantify::Unit::Prefix::Base
- Defined in:
- lib/quantify/unit/prefix/base_prefix.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#factor ⇒ Object
readonly
Returns the value of attribute factor.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Base
constructor
A new instance of Base.
- #is_non_si_prefix? ⇒ Boolean
- #is_si_prefix? ⇒ Boolean
- #label ⇒ Object
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
19 20 21 22 23 |
# File 'lib/quantify/unit/prefix/base_prefix.rb', line 19 def initialize() @symbol = [:symbol].remove_underscores @factor = [:factor].to_f @name = [:name].remove_underscores.downcase end |
Instance Attribute Details
#factor ⇒ Object (readonly)
Returns the value of attribute factor.
17 18 19 |
# File 'lib/quantify/unit/prefix/base_prefix.rb', line 17 def factor @factor end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/quantify/unit/prefix/base_prefix.rb', line 17 def name @name end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
17 18 19 |
# File 'lib/quantify/unit/prefix/base_prefix.rb', line 17 def symbol @symbol end |
Class Method Details
.configure(&block) ⇒ Object
13 14 15 |
# File 'lib/quantify/unit/prefix/base_prefix.rb', line 13 def self.configure(&block) self.class_eval(&block) if block end |
Instance Method Details
#is_non_si_prefix? ⇒ Boolean
29 30 31 |
# File 'lib/quantify/unit/prefix/base_prefix.rb', line 29 def is_non_si_prefix? self.is_a?(NonSI) end |
#is_si_prefix? ⇒ Boolean
25 26 27 |
# File 'lib/quantify/unit/prefix/base_prefix.rb', line 25 def is_si_prefix? self.is_a? SI end |
#label ⇒ Object
33 34 35 |
# File 'lib/quantify/unit/prefix/base_prefix.rb', line 33 def label symbol end |