Class: Atomy::Method::Branch

Inherits:
Object
  • Object
show all
Defined in:
lib/atomy/method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(receiver = nil, arguments = [], default_arguments = [], splat_argument = nil, post_arguments = [], proc_argument = nil, &body) ⇒ Branch

Returns a new instance of Branch.



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/atomy/method.rb', line 40

def initialize(receiver = nil, arguments = [], default_arguments = [],
               splat_argument = nil, post_arguments = [],
               proc_argument = nil, &body)
  @body = body.block
  @receiver = receiver
  @arguments = arguments
  @default_arguments = default_arguments
  @splat_argument = splat_argument
  @post_arguments = post_arguments
  @proc_argument = proc_argument
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



35
36
37
# File 'lib/atomy/method.rb', line 35

def arguments
  @arguments
end

#bodyObject (readonly)

Returns the value of attribute body.



35
36
37
# File 'lib/atomy/method.rb', line 35

def body
  @body
end

#default_argumentsObject (readonly)

Returns the value of attribute default_arguments.



35
36
37
# File 'lib/atomy/method.rb', line 35

def default_arguments
  @default_arguments
end

#nameObject

Returns the value of attribute name.



38
39
40
# File 'lib/atomy/method.rb', line 38

def name
  @name
end

#post_argumentsObject (readonly)

Returns the value of attribute post_arguments.



35
36
37
# File 'lib/atomy/method.rb', line 35

def post_arguments
  @post_arguments
end

#proc_argumentObject (readonly)

Returns the value of attribute proc_argument.



35
36
37
# File 'lib/atomy/method.rb', line 35

def proc_argument
  @proc_argument
end

#receiverObject (readonly)

Returns the value of attribute receiver.



35
36
37
# File 'lib/atomy/method.rb', line 35

def receiver
  @receiver
end

#splat_argumentObject (readonly)

Returns the value of attribute splat_argument.



35
36
37
# File 'lib/atomy/method.rb', line 35

def splat_argument
  @splat_argument
end

Instance Method Details

#as_methodObject



77
78
79
# File 'lib/atomy/method.rb', line 77

def as_method
  Rubinius::BlockEnvironment::AsMethod.new(@body)
end

#default_arguments_countObject



56
57
58
# File 'lib/atomy/method.rb', line 56

def default_arguments_count
  @default_arguments.size
end

#for_method!Object



68
69
70
71
# File 'lib/atomy/method.rb', line 68

def for_method!
  @method = true
  self
end

#method?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/atomy/method.rb', line 73

def method?
  @method
end

#post_arguments_countObject



60
61
62
# File 'lib/atomy/method.rb', line 60

def post_arguments_count
  @post_arguments.size
end

#pre_arguments_countObject



52
53
54
# File 'lib/atomy/method.rb', line 52

def pre_arguments_count
  @arguments.size
end

#splat_indexObject



64
65
66
# File 'lib/atomy/method.rb', line 64

def splat_index
  @arguments.size + @default_arguments.size if @splat_argument
end