14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/composable/core/composable_dsl.rb', line 14
def composable(attribute, **options, &block)
composables[attribute.to_sym] ||= Composable.new(attribute)
composables[attribute.to_sym].evaluate(**options, &block)
return if attributes.include?(attribute.to_sym)
attribute attribute
alias_method "#{attribute}_original_setter=", "#{attribute}="
define_method("#{attribute}=") do |value|
send("#{attribute}_original_setter=", value)
composables[attribute.to_sym].sync_attributes(
self, composable_record_for(attribute), reverse: true
)
end
end
|