Module: TentSchemas
Instance Method Summary collapse
Instance Method Details
#[](k) ⇒ Object
20 21 22 |
# File 'lib/tent-schemas.rb', line 20 def [](k) schemas[k] end |
#each(&block) ⇒ Object
16 17 18 |
# File 'lib/tent-schemas.rb', line 16 def each(&block) schemas.each(&block) end |
#schema ⇒ Object
24 25 26 |
# File 'lib/tent-schemas.rb', line 24 def schema { 'schemas' => schemas } end |
#schema_files ⇒ Object
6 7 8 |
# File 'lib/tent-schemas.rb', line 6 def schema_files Dir.glob(File.('../../schemas/*', __FILE__)) end |
#schemas ⇒ Object
10 11 12 13 14 |
# File 'lib/tent-schemas.rb', line 10 def schemas @schemas ||= schema_files.inject(Hash.new { |h,k| h[k.to_s] }) { |hash,schema| hash.merge(File.basename(schema, '.yaml') => YAML.load(File.read(schema))) } end |