Class: MethodArgs::ArgList

Inherits:
Array
  • Object
show all
Defined in:
lib/method_args.rb

Defined Under Namespace

Classes: Arg

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cls) ⇒ ArgList

Returns a new instance of ArgList.



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

def initialize(cls)
  @cls = cls
end

Instance Attribute Details

#clsObject (readonly)

Returns the value of attribute cls.



58
59
60
# File 'lib/method_args.rb', line 58

def cls
  @cls
end

#owning_methodObject

Returns the value of attribute owning_method.



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

def owning_method
  @owning_method
end

Instance Method Details

#cloneObject



64
65
66
67
68
# File 'lib/method_args.rb', line 64

def clone
  o = super
  o.each {|arg| arg.arg_list = o}
  o
end

#namesObject



75
76
77
# File 'lib/method_args.rb', line 75

def names
  map(&:name)
end

#required_sizeObject Also known as: required_count



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

def required_size
  inject(0) {|count, arg| count += arg.required? ? 1 : 0}
end

#typesObject



79
80
81
# File 'lib/method_args.rb', line 79

def types
  map(&:type)
end