Class: Fried::Schema::CreateDefinitionIfMissing
- Inherits:
-
Object
- Object
- Fried::Schema::CreateDefinitionIfMissing
- Defined in:
- lib/fried/schema/create_definition_if_missing.rb
Overview
Creates schema definition if missing
Instance Attribute Summary collapse
-
#get_definition ⇒ Object
Returns the value of attribute get_definition.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#get_definition ⇒ Object
Returns the value of attribute get_definition.
8 9 10 |
# File 'lib/fried/schema/create_definition_if_missing.rb', line 8 def get_definition @get_definition end |
Class Method Details
.build ⇒ Object
10 11 12 13 14 |
# File 'lib/fried/schema/create_definition_if_missing.rb', line 10 def self.build new.tap do |instance| instance.get_definition = GetDefinition.build end end |
.call(obj) ⇒ Object
16 17 18 19 |
# File 'lib/fried/schema/create_definition_if_missing.rb', line 16 def self.call(obj) instance = build instance.(obj) end |
Instance Method Details
#call(obj) ⇒ Definition
23 24 25 26 27 |
# File 'lib/fried/schema/create_definition_if_missing.rb', line 23 def call(obj) schema = get_definition.(obj) schema || obj.instance_variable_set(:@__fried_schema__, Definition.new) end |