Module: Render
- Defined in:
- lib/render.rb,
lib/render/graph.rb,
lib/render/errors.rb,
lib/render/schema.rb,
lib/render/version.rb,
lib/render/attribute.rb,
lib/render/generator.rb,
lib/render/dottable_hash.rb
Defined Under Namespace
Modules: Errors Classes: Attribute, DottableHash, Generator, Graph, Schema
Constant Summary collapse
- VERSION =
"0.0.2"
Class Attribute Summary collapse
-
.generators ⇒ Object
Returns the value of attribute generators.
-
.live ⇒ Object
Returns the value of attribute live.
-
.schemas ⇒ Object
Returns the value of attribute schemas.
Class Method Summary collapse
Class Attribute Details
.generators ⇒ Object
Returns the value of attribute generators.
20 21 22 |
# File 'lib/render.rb', line 20 def generators @generators end |
.live ⇒ Object
Returns the value of attribute live.
20 21 22 |
# File 'lib/render.rb', line 20 def live @live end |
.schemas ⇒ Object
Returns the value of attribute schemas.
20 21 22 |
# File 'lib/render.rb', line 20 def schemas @schemas end |
Class Method Details
.load_schemas!(directory) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/render.rb', line 22 def load_schemas!(directory) Dir.glob("#{directory}/**/*.json").each do |schema_file| parsed_schema = parse_schema(File.read(schema_file)) schema_title = parsed_schema[:title].to_sym # TODO Throw an error in the event of conflicts? self.schemas[schema_title] = parsed_schema end end |
.parse_schema(json) ⇒ Object
31 32 33 |
# File 'lib/render.rb', line 31 def parse_schema(json) JSON.parse(json).recursive_symbolize_keys! end |
.parse_type(type) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/render.rb', line 35 def parse_type(type) if type.is_a?(String) return UUID if type == "uuid" return Boolean if type == "boolean" Object.const_get(type.capitalize) # TODO better type parsing else type end end |