Class: JsonSchemaRails::Loaders::Directory
- Defined in:
- lib/json_schema_rails/loaders/directory.rb
Instance Attribute Summary collapse
-
#extnames ⇒ Object
Returns the value of attribute extnames.
-
#path ⇒ Object
Returns the value of attribute path.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(path, options = {}) ⇒ Directory
constructor
A new instance of Directory.
- #load_schema!(schema_path) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(path, options = {}) ⇒ Directory
Returns a new instance of Directory.
6 7 8 9 10 |
# File 'lib/json_schema_rails/loaders/directory.rb', line 6 def initialize(path, = {}) @path = path @extnames = .delete(:extnames) { %w(.yml .yaml .json) } super() end |
Instance Attribute Details
#extnames ⇒ Object
Returns the value of attribute extnames.
4 5 6 |
# File 'lib/json_schema_rails/loaders/directory.rb', line 4 def extnames @extnames end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/json_schema_rails/loaders/directory.rb', line 4 def path @path end |
Instance Method Details
#load_schema!(schema_path) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/json_schema_rails/loaders/directory.rb', line 12 def load_schema!(schema_path) with_cache(schema_path) do file_path = lookup_schema_file(schema_path) or raise SchemaNotFound load_schema_file(file_path) end end |