module Eapi::Methods::Properties::InstanceMethods
Public Instance Methods
_properties()
click to toggle source
# File lib/eapi/methods/properties.rb, line 7 def _properties self.class.properties end
convert_value(value, convert_with = nil)
click to toggle source
# File lib/eapi/methods/properties.rb, line 36 def convert_value(value, convert_with = nil) Eapi::ValueConverter.convert_value(value, self, convert_with) end
converted_or_default_value_for(property)
click to toggle source
# File lib/eapi/methods/properties.rb, line 40 def converted_or_default_value_for(property) yield_final_value_for(property) { |val| return val } end
converted_value_for(prop)
click to toggle source
# File lib/eapi/methods/properties.rb, line 32 def converted_value_for(prop) convert_value get(prop), self.class.defined_convert_with_for(prop) end
final_value_for(property)
click to toggle source
# File lib/eapi/methods/properties.rb, line 44 def final_value_for(property) converted_or_default_value_for(property) end
get(field)
click to toggle source
# File lib/eapi/methods/properties.rb, line 11 def get(field) getter = Eapi::Methods::Names.getter field send(getter) end
prepare_value_for(prop)
click to toggle source
# File lib/eapi/methods/properties.rb, line 21 def prepare_value_for(prop) value = get(prop) prepare_with = self.class.defined_prepare_with_for(prop) if prepare_with convert_value(value, prepare_with) else value end end
set(field, value)
click to toggle source
# File lib/eapi/methods/properties.rb, line 16 def set(field, value) setter = Eapi::Methods::Names.fluent_setter field send(setter, value) end
to_be_ignored?(value, property)
click to toggle source
# File lib/eapi/methods/properties.rb, line 62 def to_be_ignored?(value, property) Eapi::ValueIgnoreChecker.to_be_ignored? value, self.class.ignore_definition(property) end
yield_final_value_for(property) { |val| ... }
click to toggle source
will yield the converted value if it is not to be ignored, will yield the default value if it is set and the converted value is to be ignored will not yield anything otherwise
# File lib/eapi/methods/properties.rb, line 51 def yield_final_value_for(property) val = converted_value_for(property) accepted = !to_be_ignored?(val, property) if accepted yield val elsif self.class.default_value_for?(property) yield self.class.default_value_for(property) end end
Private Instance Methods
set_value_in_final_hash(hash, property)
click to toggle source
# File lib/eapi/methods/properties.rb, line 67 def set_value_in_final_hash(hash, property) yield_final_value_for(property) do |val| hash[property] = val end end