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.



54
55
56
# File 'lib/method_args.rb', line 54

def initialize(cls)
  @cls = cls
end

Instance Attribute Details

#clsObject (readonly)

Returns the value of attribute cls.



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

def cls
  @cls
end

#owning_methodObject

Returns the value of attribute owning_method.



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

def owning_method
  @owning_method
end

Instance Method Details

#cloneObject



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

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

#namesObject



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

def names
  map(&:name)
end

#required_sizeObject Also known as: required_count



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

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

#typesObject



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

def types
  map(&:type)
end