lib/jimmy/schema_creation.rb in jimmy-0.3.2 vs lib/jimmy/schema_creation.rb in jimmy-0.3.3
- old
+ new
@@ -19,11 +19,20 @@
end
klass.include DefiningMethods
end
end
+ module MetadataMethods
+ def set(**values)
+ values.each { |k, v| data[k.to_s] = v }
+ end
+
+ %i[title description default].each { |k| define_method(k) { |v| set k => v } }
+ end
+
module DefiningMethods
+ include MetadataMethods
def locals
@locals ||= {}
end
@@ -37,15 +46,9 @@
end
def respond_to_missing?(method, *)
locals.key?(method) || reserved?(method, false) || super
end
-
- def set(**values)
- values.each { |k, v| data[k.to_s] = v }
- end
-
- %i[title description default].each { |k| define_method(k) { |v| set k => v } }
def method_missing(method, *args, &block)
return locals[method] if locals.key?(method)
if SchemaTypes.key? method