Class: Zapata::Primitive::Defs
- Inherits:
-
Base
- Object
- Base
- Zapata::Primitive::Defs
show all
- Defined in:
- lib/zapata/primitive/defs.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#code, #type
Instance Method Summary
collapse
Methods inherited from Base
#dive_deeper, #name, #return_with_missing_as_super, #return_with_super_as_missing, #to_raw
Constructor Details
#initialize(code) ⇒ Defs
Returns a new instance of Defs.
8
9
10
11
12
13
|
# File 'lib/zapata/primitive/defs.rb', line 8
def initialize(code)
@code = code
@klass = Diver.current_klass
@access_level = Diver.access_level
dive_deeper
end
|
Instance Attribute Details
#klass ⇒ Object
Returns the value of attribute klass.
6
7
8
|
# File 'lib/zapata/primitive/defs.rb', line 6
def klass
@klass
end
|
Instance Method Details
#literal_predicted_args ⇒ Object
29
30
31
|
# File 'lib/zapata/primitive/defs.rb', line 29
def literal_predicted_args
Predictor::Args.literal(node.args)
end
|
#node ⇒ Object
23
24
25
26
27
|
# File 'lib/zapata/primitive/defs.rb', line 23
def node
_, name, args, body = @code.to_a
type = @code.type
OpenStruct.new(type: type, name: name, args: args, body: body)
end
|
#public? ⇒ Boolean
19
20
21
|
# File 'lib/zapata/primitive/defs.rb', line 19
def public?
@access_level == :public
end
|
#self? ⇒ Boolean
15
16
17
|
# File 'lib/zapata/primitive/defs.rb', line 15
def self?
true
end
|