Class: Helper::SchemaListHelper
- Inherits:
-
Object
- Object
- Helper::SchemaListHelper
- Defined in:
- lib/helper/schema_list_helper.rb
Defined Under Namespace
Classes: ValidationErrorException
Instance Method Summary collapse
-
#initialize(schema_name, schema_path = "api/schemas/data/orchestrate.json") ⇒ SchemaListHelper
constructor
A new instance of SchemaListHelper.
- #schema_exists? ⇒ Boolean
- #schema_path ⇒ Object
Constructor Details
#initialize(schema_name, schema_path = "api/schemas/data/orchestrate.json") ⇒ SchemaListHelper
Returns a new instance of SchemaListHelper.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/helper/schema_list_helper.rb', line 9 def initialize( schema_name, schema_path = "api/schemas/data/orchestrate.json" ) @schema_name = schema_name.to_sym @schema_path = schema_path data = File.read File.join Dir.pwd, @schema_path schema_variations = JSON.parse(data).deep_transform_keys(&:to_sym) @schema_active = schema_variations[@schema_name] end |
Instance Method Details
#schema_exists? ⇒ Boolean
22 23 24 |
# File 'lib/helper/schema_list_helper.rb', line 22 def schema_exists? @schema_active != nil end |
#schema_path ⇒ Object
26 27 28 |
# File 'lib/helper/schema_list_helper.rb', line 26 def schema_path @schema_active[:schema_path] end |