Module: Argumentation
- Included in:
- Quarter
- Defined in:
- lib/quarter_system/argumentation.rb,
lib/quarter_system/argumentation/constants.rb
Constant Summary collapse
- REGES =
{ :with_method_name => '(?:_with_([a-z0-9]+(?:[a-z0-9]|_(?![_=\b]))*?))?', :method_name => '([a-z0-9]+(?:[a-z0-9]|_(?![_=\b]))*?)', :method_name_with_setter => '([a-z0-9]+(?:[a-z0-9]|_(?![_=\b]))*?)(=?)', :method_name_without_capture => '(?:[a-z0-9]+(?:[a-z0-9]|_(?![_=\b]))*?)' }
- REGEX =
REGEX is the Regular Expression that is not anchored.
Hash[*REGES.to_a.map do |arr| [ arr[0], if arr[1].is_a?(Hash) Hash[*arr[1].to_a.map { |key, reges| [ key, Regexp.new(reges, Regexp::IGNORECASE) ] }.flatten] else Regexp.new(arr[1]
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_symbol, *arguments, &block) ⇒ Object (private)
14 15 16 17 18 |
# File 'lib/quarter_system/argumentation.rb', line 14 def method_missing(method_symbol, *arguments, &block) method_symbol.to_s.match(methods_match_regexp).only_if_a?(MatchData) do |md| md[1].split('_and_').push(md[2]).map { |prop_name| :"#{prop_name}_from_args" }.map { |method_sym| send(method_sym, *arguments) if respond_to?(method_sym) } end || super end |