Module: Af::Application::Component::ClassMethods
- Defined in:
- lib/fiksu-af/application/component.rb
Instance Method Summary collapse
- #add_target_container(extra_stuff) ⇒ Object
- #create_class_proxy_logger(prefix = "", logger_name = self.name) ⇒ Object
- #create_proxy_logger(prefix = "", logger_name = self.name, create_class_method = false) ⇒ Object
- #opt(long_name, *extra_stuff, &b) ⇒ Object
- #opt_check(var_name, *extra_stuff, &b) ⇒ Object
- #opt_group(group_name, *extra_stuff, &b) ⇒ Object
- #opt_select(var_name, *extra_stuff, &b) ⇒ Object
Instance Method Details
#add_target_container(extra_stuff) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/fiksu-af/application/component.rb', line 65 def add_target_container(extra_stuff) extra_hash = {} if extra_stuff[-1].is_a? Hash extra_hash = extra_stuff.pop end extra_stuff.push extra_hash.merge({ target_container: self, containing_class: self }) end |
#create_class_proxy_logger(prefix = "", logger_name = self.name) ⇒ Object
41 42 43 |
# File 'lib/fiksu-af/application/component.rb', line 41 def create_class_proxy_logger(prefix = "", logger_name = self.name) create_proxy_logger(prefix, logger_name, true) end |
#create_proxy_logger(prefix = "", logger_name = self.name, create_class_method = false) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fiksu-af/application/component.rb', line 27 def create_proxy_logger(prefix = "", logger_name = self.name, create_class_method = false) prefix = prefix.to_s if !prefix.blank? && prefix[-1] != '_' prefix = "#{prefix}_" end method_name = "#{prefix}logger" class_eval <<-CLASS_EVAL def #{create_class_method ? 'self.' : ''}#{method_name} return Log4r::Logger['#{logger_name}'] || Log4r::Logger.new('#{logger_name}') end CLASS_EVAL end |
#opt(long_name, *extra_stuff, &b) ⇒ Object
45 46 47 48 |
# File 'lib/fiksu-af/application/component.rb', line 45 def opt(long_name, *extra_stuff, &b) add_target_container(extra_stuff) return ::Af::Application.opt(long_name, *extra_stuff, &b) end |
#opt_check(var_name, *extra_stuff, &b) ⇒ Object
55 56 57 58 |
# File 'lib/fiksu-af/application/component.rb', line 55 def opt_check(var_name, *extra_stuff, &b) add_target_container(extra_stuff) return ::Af::Application.opt_check(var_name, *extra_stuff, &b) end |
#opt_group(group_name, *extra_stuff, &b) ⇒ Object
50 51 52 53 |
# File 'lib/fiksu-af/application/component.rb', line 50 def opt_group(group_name, *extra_stuff, &b) add_target_container(extra_stuff) return ::Af::Application.opt_group(group_name, *extra_stuff, &b) end |
#opt_select(var_name, *extra_stuff, &b) ⇒ Object
60 61 62 63 |
# File 'lib/fiksu-af/application/component.rb', line 60 def opt_select(var_name, *extra_stuff, &b) add_target_container(extra_stuff) return ::Af::Application.opt_select(var_name, *extra_stuff, &b) end |