Method: OutputMode::Callable#method_char

Defined in:
lib/output_mode/callable.rb

#method_char(bang!) ⇒ '!' #method_char(question?) ⇒ '?' #method_char(other) ⇒ Nil

Determines the “type” associated with a dynamic method

Overloads:

  • #method_char(bang!) ⇒ '!'

    Parameters:

    • bang!

      A symbol/string ending with !

    Returns:

    • ('!')
  • #method_char(question?) ⇒ '?'

    Parameters:

    • question?

      A symbol/string ending with ?

    Returns:

    • ('?')
  • #method_char(other) ⇒ Nil

    Parameters:

    • other

      Any other symbol/string

    Returns:

    • (Nil)


193
194
195
196
# File 'lib/output_mode/callable.rb', line 193

def method_char(s)
  char = s[-1]
  ['?', '!'].include?(char) ? char : nil
end