Class: Foreman::Parameters::Caster
- Defined in:
- app/services/foreman/parameters/caster.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #cast ⇒ Object
- #cast! ⇒ Object
-
#initialize(item, options = {}) ⇒ Caster
constructor
A new instance of Caster.
Constructor Details
#initialize(item, options = {}) ⇒ Caster
Returns a new instance of Caster.
6 7 8 9 10 11 12 13 14 |
# File 'app/services/foreman/parameters/caster.rb', line 6 def initialize(item, = {}) defaults = { :attribute_name => :value, :to => :string, } .reverse_merge!(defaults) @item, @options = item, @value = @options[:value].nil? ? @item.send(@options[:attribute_name]) : @options[:value] end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value
4 5 6 |
# File 'app/services/foreman/parameters/caster.rb', line 4 def value @value end |