Class: DissociatedIntrospection::MethodCall::Argument

Inherits:
Object
  • Object
show all
Defined in:
lib/dissociated_introspection/method_call.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ast) ⇒ Argument

Returns a new instance of Argument.



53
54
55
# File 'lib/dissociated_introspection/method_call.rb', line 53

def initialize(ast)
  @ast = ast
end

Instance Attribute Details

#astObject (readonly)

Returns the value of attribute ast.



51
52
53
# File 'lib/dissociated_introspection/method_call.rb', line 51

def ast
  @ast
end

Instance Method Details

#to_hObject



70
71
72
# File 'lib/dissociated_introspection/method_call.rb', line 70

def to_h
  { type: type, value: value }
end

#typeObject



57
58
59
# File 'lib/dissociated_introspection/method_call.rb', line 57

def type
  ast.type
end

#valueObject



61
62
63
64
65
66
67
68
# File 'lib/dissociated_introspection/method_call.rb', line 61

def value
  case type
  when :block
    Block.new(ast.children)
  else
    ast.children[0]
  end
end