Class: Numerals::ContextConversion
- Inherits:
-
Object
- Object
- Numerals::ContextConversion
- Defined in:
- lib/numerals/conversions/context_conversion.rb
Overview
Base class for Conversions of type with context
Direct Known Subclasses
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#input_rounding ⇒ Object
Returns the value of attribute input_rounding.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(context_or_type, options = {}) ⇒ ContextConversion
constructor
A new instance of ContextConversion.
Constructor Details
#initialize(context_or_type, options = {}) ⇒ ContextConversion
Returns a new instance of ContextConversion.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/numerals/conversions/context_conversion.rb', line 9 def initialize(context_or_type, ={}) if Class === context_or_type && context_or_type.respond_to?(:context) @type = context_or_type @context = @type.context elsif context_or_type.respond_to?(:num_class) @context = context_or_type @type = @context.num_class else raise "Invalid Conversion definition" end self.input_rounding = [:input_rounding] end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
22 23 24 |
# File 'lib/numerals/conversions/context_conversion.rb', line 22 def context @context end |
#input_rounding ⇒ Object
Returns the value of attribute input_rounding.
22 23 24 |
# File 'lib/numerals/conversions/context_conversion.rb', line 22 def input_rounding @input_rounding end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
22 23 24 |
# File 'lib/numerals/conversions/context_conversion.rb', line 22 def type @type end |