Class: Af::OptionParser::OptionStore

Inherits:
Object
  • Object
show all
Defined in:
lib/fiksu-af/option_parser/option_store.rb

Constant Summary collapse

@@option_stores =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(containing_class) ⇒ OptionStore

Returns a new instance of OptionStore.



11
12
13
14
15
16
17
# File 'lib/fiksu-af/option_parser/option_store.rb', line 11

def initialize(containing_class)
  @containing_class = containing_class
  @options = {}
  @option_groups = {}
  @option_checks = {}
  @option_selects = {}
end

Instance Attribute Details

#containing_classObject (readonly)

Returns the value of attribute containing_class.



3
4
5
# File 'lib/fiksu-af/option_parser/option_store.rb', line 3

def containing_class
  @containing_class
end

#option_checksObject (readonly)

Returns the value of attribute option_checks.



3
4
5
# File 'lib/fiksu-af/option_parser/option_store.rb', line 3

def option_checks
  @option_checks
end

#option_groupsObject (readonly)

Returns the value of attribute option_groups.



3
4
5
# File 'lib/fiksu-af/option_parser/option_store.rb', line 3

def option_groups
  @option_groups
end

#option_selectsObject (readonly)

Returns the value of attribute option_selects.



3
4
5
# File 'lib/fiksu-af/option_parser/option_store.rb', line 3

def option_selects
  @option_selects
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/fiksu-af/option_parser/option_store.rb', line 3

def options
  @options
end

Class Method Details

.factory(containing_class) ⇒ Object



27
28
29
30
# File 'lib/fiksu-af/option_parser/option_store.rb', line 27

def self.factory(containing_class)
  @@option_stores[containing_class] ||= new(containing_class)
  return @@option_stores[containing_class]
end

.find(containing_class) ⇒ Object


*** Class Methods *** ++++++++++++++++++++++



23
24
25
# File 'lib/fiksu-af/option_parser/option_store.rb', line 23

def self.find(containing_class)
  return @@option_stores[containing_class]
end

Instance Method Details

#construct_option(long_name) ⇒ Object



40
41
42
43
# File 'lib/fiksu-af/option_parser/option_store.rb', line 40

def construct_option(long_name)
  @options[long_name] ||= {}
  return @options[long_name]
end

#construct_option_check(var_name) ⇒ Object



66
67
68
69
# File 'lib/fiksu-af/option_parser/option_store.rb', line 66

def construct_option_check(var_name)
  @option_checks[var_name] ||= {}
  return @option_checks[var_name]
end

#construct_option_group(name) ⇒ Object



53
54
55
56
# File 'lib/fiksu-af/option_parser/option_store.rb', line 53

def construct_option_group(name)
  @option_groups[name] ||= {}
  return @option_groups[name]
end

#construct_option_select(var_name) ⇒ Object



79
80
81
82
# File 'lib/fiksu-af/option_parser/option_store.rb', line 79

def construct_option_select(var_name)
  @option_selects[var_name] ||= {}
  return @option_selects[var_name]
end

#find_option(long_name) ⇒ Object


*** Instance Methods *** +++++++++++++++++++++++++



36
37
38
# File 'lib/fiksu-af/option_parser/option_store.rb', line 36

def find_option(long_name)
  return options[long_name]
end

#find_option_check(var_name) ⇒ Object



62
63
64
# File 'lib/fiksu-af/option_parser/option_store.rb', line 62

def find_option_check(var_name)
  return option_checks[var_name]
end

#find_option_group(long_name) ⇒ Object



49
50
51
# File 'lib/fiksu-af/option_parser/option_store.rb', line 49

def find_option_group(long_name)
  return option_groups[long_name]
end

#find_option_select(var_name) ⇒ Object



75
76
77
# File 'lib/fiksu-af/option_parser/option_store.rb', line 75

def find_option_select(var_name)
  return option_selects[var_name]
end

#get_option(long_name) ⇒ Object



45
46
47
# File 'lib/fiksu-af/option_parser/option_store.rb', line 45

def get_option(long_name)
  return find_option(long_name) || construct_option(long_name)
end

#get_option_check(var_name) ⇒ Object



71
72
73
# File 'lib/fiksu-af/option_parser/option_store.rb', line 71

def get_option_check(var_name)
  return find_option_check(var_name) || construct_option_check(var_name)
end

#get_option_group(long_name) ⇒ Object



58
59
60
# File 'lib/fiksu-af/option_parser/option_store.rb', line 58

def get_option_group(long_name)
  return find_option_group(long_name) || construct_option_group(long_name)
end

#get_option_select(var_name) ⇒ Object



84
85
86
# File 'lib/fiksu-af/option_parser/option_store.rb', line 84

def get_option_select(var_name)
  return find_option_select(var_name) || construct_option_select(var_name)
end