class DissociatedIntrospection::MethodCall

Attributes

ruby_code[R]

Public Class Methods

new(ruby_code) click to toggle source
# File lib/dissociated_introspection/method_call.rb, line 25
def initialize(ruby_code)
  @ruby_code = ruby_code
end

Public Instance Methods

arguments() click to toggle source
# File lib/dissociated_introspection/method_call.rb, line 29
def arguments
  ruby_code.ast.children[2..-1].map do |c|
    case c.type
    when :sym, :str
      c.to_a.first
    when :block
      Lambda.new(c)
    else
      c
    end
  end
end
name() click to toggle source
# File lib/dissociated_introspection/method_call.rb, line 42
def name
  ruby_code.ast.children[1]
end
to_h() click to toggle source
# File lib/dissociated_introspection/method_call.rb, line 46
def to_h
  { name: name, arguments: arguments }
end