Class: Spout::Models::Dictionary

Inherits:
Object
  • Object
show all
Defined in:
lib/spout/models/dictionary.rb

Overview

Creates a structure that contains a dictionaries variables, domains, and forms

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_path) ⇒ Dictionary

Returns a new instance of Dictionary.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/spout/models/dictionary.rb', line 17

def initialize(app_path)
  @app_path = app_path

  @variable_files = json_files("variables")
  @domain_files = json_files("domains")
  @form_files = json_files("forms")

  @variables = []
  @domains = []
  @forms = []
end

Instance Attribute Details

#app_pathObject

Returns the value of attribute app_path.



13
14
15
# File 'lib/spout/models/dictionary.rb', line 13

def app_path
  @app_path
end

#domain_filesObject (readonly)

Returns the value of attribute domain_files.



15
16
17
# File 'lib/spout/models/dictionary.rb', line 15

def domain_files
  @domain_files
end

#domainsObject

Returns the value of attribute domains.



12
13
14
# File 'lib/spout/models/dictionary.rb', line 12

def domains
  @domains
end

#form_filesObject (readonly)

Returns the value of attribute form_files.



15
16
17
# File 'lib/spout/models/dictionary.rb', line 15

def form_files
  @form_files
end

#formsObject

Returns the value of attribute forms.



12
13
14
# File 'lib/spout/models/dictionary.rb', line 12

def forms
  @forms
end

#variable_filesObject (readonly)

Returns the value of attribute variable_files.



15
16
17
# File 'lib/spout/models/dictionary.rb', line 15

def variable_files
  @variable_files
end

#variablesObject

Returns the value of attribute variables.



12
13
14
# File 'lib/spout/models/dictionary.rb', line 12

def variables
  @variables
end

Instance Method Details

#load_all!Object



29
30
31
32
33
34
# File 'lib/spout/models/dictionary.rb', line 29

def load_all!
  load_variables!
  load_domains!
  load_forms!
  self
end

#load_domains!Object



40
41
42
# File 'lib/spout/models/dictionary.rb', line 40

def load_domains!
  load_type!("Domain")
end

#load_forms!Object



44
45
46
# File 'lib/spout/models/dictionary.rb', line 44

def load_forms!
  load_type!("Form")
end

#load_variables!Object



36
37
38
# File 'lib/spout/models/dictionary.rb', line 36

def load_variables!
  load_type!("Variable")
end