Class: Helper::SchemaListHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/helper/schema_list_helper.rb

Defined Under Namespace

Classes: ValidationErrorException

Instance Method Summary collapse

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

Returns:

  • (Boolean)


22
23
24
# File 'lib/helper/schema_list_helper.rb', line 22

def schema_exists?
  @schema_active != nil
end

#schema_pathObject



26
27
28
# File 'lib/helper/schema_list_helper.rb', line 26

def schema_path
  @schema_active[:schema_path]
end