Module: TentSchemas

Extended by:
TentSchemas
Included in:
TentSchemas
Defined in:
lib/tent-schemas.rb

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

#schemaObject



24
25
26
# File 'lib/tent-schemas.rb', line 24

def schema
  { 'schemas' => schemas }
end

#schema_filesObject



6
7
8
# File 'lib/tent-schemas.rb', line 6

def schema_files
  Dir.glob(File.expand_path('../../schemas/*', __FILE__))
end

#schemasObject



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