Module: Eapi::Methods::Properties::InstanceMethods
- Defined in:
- lib/eapi/methods/properties.rb
Instance Method Summary collapse
- #_properties ⇒ Object
- #convert_value(value) ⇒ Object
- #converted_or_default_value_for(property) ⇒ Object
- #converted_value_for(prop) ⇒ Object
- #get(field) ⇒ Object
- #set(field, value) ⇒ Object
- #to_be_ignored?(value, property) ⇒ Boolean
-
#yield_final_value_for(property) ⇒ Object
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.
Instance Method Details
#_properties ⇒ Object
7 8 9 |
# File 'lib/eapi/methods/properties.rb', line 7 def _properties self.class.properties end |
#convert_value(value) ⇒ Object
25 26 27 |
# File 'lib/eapi/methods/properties.rb', line 25 def convert_value(value) Eapi::ValueConverter.convert_value(value) end |
#converted_or_default_value_for(property) ⇒ Object
29 30 31 |
# File 'lib/eapi/methods/properties.rb', line 29 def converted_or_default_value_for(property) yield_final_value_for(property) { |val| return val } end |
#converted_value_for(prop) ⇒ Object
21 22 23 |
# File 'lib/eapi/methods/properties.rb', line 21 def converted_value_for(prop) convert_value get(prop) end |
#get(field) ⇒ Object
11 12 13 14 |
# File 'lib/eapi/methods/properties.rb', line 11 def get(field) getter = Eapi::Methods::Names.getter field send(getter) end |
#set(field, value) ⇒ Object
16 17 18 19 |
# 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) ⇒ Boolean
47 48 49 |
# File 'lib/eapi/methods/properties.rb', line 47 def to_be_ignored?(value, property) Eapi::ValueIgnoreChecker.to_be_ignored? value, self.class.ignore_definition(property) end |
#yield_final_value_for(property) ⇒ Object
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
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/eapi/methods/properties.rb', line 36 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 |