Class: Af::OptionParser::OptionFinder
- Inherits:
-
Object
- Object
- Af::OptionParser::OptionFinder
- Defined in:
- lib/fiksu-af/option_parser/option_finder.rb
Instance Method Summary collapse
- #all_option_checks ⇒ Object
- #all_option_groups ⇒ Object
- #all_option_selects ⇒ Object
-
#all_options ⇒ Object
————————- *** Instance Methods *** +++++++++++++++++++++++++.
- #all_options_by_long_name ⇒ Object
- #find_option(long_name) ⇒ Object
-
#initialize(class_path) ⇒ OptionFinder
constructor
A new instance of OptionFinder.
Constructor Details
#initialize(class_path) ⇒ OptionFinder
Returns a new instance of OptionFinder.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fiksu-af/option_parser/option_finder.rb', line 4 def initialize(class_path) @class_path = class_path @all_options = {} @all_option_groups = {} @all_option_checks = {} @all_option_selects = {} # class_path: # Class: include class and all its ancestors options @class_path.each do |klass| klass.ancestors.reverse.each do |ancestor| option_store = OptionStore.find(ancestor) if option_store = option_store. if .present? .each do |long_name, option| merged_option = @all_options[long_name] ||= Option.new(long_name) merged_option.set_instance_variables(option) end end option_groups = option_store.option_groups if option_groups.present? option_groups.each do |name, option_group| merged_option_group = @all_option_groups[name] ||= OptionGroup.new(name) merged_option_group.set_instance_variables(option_group) end end option_checks = option_store.option_checks if option_checks.present? option_checks.each do |name, option_check| merged_option_check = @all_option_checks[name] ||= OptionCheck.new(name) merged_option_check.set_instance_variables(option_check) end end option_selects = option_store.option_selects if option_selects.present? option_selects.each do |name, option_select| merged_option_select = @all_option_selects[name] ||= OptionSelect.new(name) merged_option_select.set_instance_variables(option_select) end end end end end end |
Instance Method Details
#all_option_checks ⇒ Object
65 66 67 |
# File 'lib/fiksu-af/option_parser/option_finder.rb', line 65 def all_option_checks return @all_option_checks.values end |
#all_option_groups ⇒ Object
61 62 63 |
# File 'lib/fiksu-af/option_parser/option_finder.rb', line 61 def all_option_groups return @all_option_groups.values end |
#all_option_selects ⇒ Object
69 70 71 |
# File 'lib/fiksu-af/option_parser/option_finder.rb', line 69 def all_option_selects return @all_option_selects.values end |
#all_options ⇒ Object
*** Instance Methods *** +++++++++++++++++++++++++
57 58 59 |
# File 'lib/fiksu-af/option_parser/option_finder.rb', line 57 def return @all_options.values end |
#all_options_by_long_name ⇒ Object
73 74 75 |
# File 'lib/fiksu-af/option_parser/option_finder.rb', line 73 def return @all_options end |
#find_option(long_name) ⇒ Object
77 78 79 |
# File 'lib/fiksu-af/option_parser/option_finder.rb', line 77 def find_option(long_name) return [long_name] end |