mdc/lib/parsing/parser_state.rb
##
# Catch missing methods. Due to the fact that the parser can have a large
# amount of different states, it is cumbersome to add them all as methods
# to this class. To avoid this, the methods are created using the
# +missing_method+ method, which allows intercepting calls to non-existing
# methods.
# @param [String] name Name of the method
Catch missing methods. Due to the fact that the parser can have a large
amount of different states, it is cumbersome to add them all as methods
to this class. To avoid this, the methods are created using the
+missing_method+ method, which allows intercepting calls to non-existing
methods.
Catch missing methods . Due to the fact that the parser can have a large amount of different states it is cumbersome to add them all as methods to this class . To avoid this the methods are created using the + missing_method + method which allows intercepting calls to non - existing methods .
def method_missing(name, *_args)
      state = name.to_s.upcase.gsub(/[?!]/, '')
      symbol = state.to_sym
      super unless @possible_states.include?(symbol)
      if name.to_s.end_with?('!')
        @state = symbol
      elsif name.to_s.end_with?('?')
        @state == symbol
      else
        super
      end
    end
def method_missing ( name , * _args ) state = name . to_s . upcase . gsub ( / [?!] / , '' ) symbol = state . to_sym super unless @possible_states . include? ( symbol ) if name . to_s . end_with? ( '!' ) @state = symbol elsif name . to_s . end_with? ( '?' ) @state == symbol else super end end
Catch missing methods.
Catch missing methods .
name
<not_specific>
_args
<not_specific>
<not_specific>
name Name of the method
name Name of the method