Module: OAPI::Properties
- Included in:
- Types::Object
- Defined in:
- lib/oapi/properties.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
29 30 31 |
# File 'lib/oapi/properties.rb', line 29 def included(base) base.extend(ClassMethods) end |
Instance Method Details
#initialize ⇒ Object
34 35 36 |
# File 'lib/oapi/properties.rb', line 34 def initialize(&) instance_exec(&) if block_given? end |
#parse_property_value(value, object, ref, block) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/oapi/properties.rb', line 44 def parse_property_value(value, object, ref, block) if ref OAPI::Ref.new(ref) elsif block object.new(&block) elsif !value.nil? value else raise ArgumentError, "ref, block or value must be provided" end end |
#properties ⇒ Object
38 39 40 41 42 |
# File 'lib/oapi/properties.rb', line 38 def properties self.class.properties.keys.each_with_object({}) do |prop, acc| acc[prop] = instance_variable_get(:"@#{prop}") end end |