20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/schema_tools/modules/attributes.rb', line 20
def has_schema_attrs(schema_name, opts={})
reader = opts[:reader] || SchemaTools::Reader
schema_location = opts[:path] || opts[:schema]
schema = reader.read(schema_name, schema_location)
self.schema_name(schema_name)
schema[:properties].each do |key, val|
define_method key do
schema_attrs[key]
end
unless val[:readonly]
define_method "#{key}=" do |value|
schema_attrs[key] = value
end
end
end
end
|