Class: JsonSchemaRails::Loaders::Base
- Inherits:
-
Object
- Object
- JsonSchemaRails::Loaders::Base
show all
- Defined in:
- lib/json_schema_rails/loaders/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
11
12
13
|
# File 'lib/json_schema_rails/loaders/base.rb', line 11
def initialize(options = {})
@cache = options.fetch(:cache) { true }
end
|
Instance Attribute Details
#cache=(value) ⇒ Object
9
10
11
|
# File 'lib/json_schema_rails/loaders/base.rb', line 9
def cache=(value)
@cache = value
end
|
Instance Method Details
#cache? ⇒ Boolean
15
16
17
|
# File 'lib/json_schema_rails/loaders/base.rb', line 15
def cache?
!!@cache
end
|
#clear ⇒ Object
19
20
21
|
# File 'lib/json_schema_rails/loaders/base.rb', line 19
def clear
cache_data.clear
end
|
#load_schema(schema_path) ⇒ Object
23
24
25
26
27
|
# File 'lib/json_schema_rails/loaders/base.rb', line 23
def load_schema(schema_path)
load_schema!(schema_path)
rescue SchemaNotFound
nil
end
|
#load_schema!(schema_path) ⇒ Object
29
30
31
|
# File 'lib/json_schema_rails/loaders/base.rb', line 29
def load_schema!(schema_path)
raise NotImplementedError
end
|