Class: MethodArgs::Args

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

Defined Under Namespace

Classes: Arg

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cls) ⇒ Args

Returns a new instance of Args.



39
40
41
# File 'lib/method_args/args.rb', line 39

def initialize(cls)
  @cls = cls
end

Instance Attribute Details

#owning_methodObject

Returns the value of attribute owning_method.



37
38
39
# File 'lib/method_args/args.rb', line 37

def owning_method
  @owning_method
end

Instance Method Details

#cloneObject



47
48
49
50
51
# File 'lib/method_args/args.rb', line 47

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

#clsObject



43
44
45
# File 'lib/method_args/args.rb', line 43

def cls
  @cls.inject(Module) {|c, m| c.const_get(m)}
end

#namesObject



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

def names
  map(&:name)
end

#required_sizeObject Also known as: required_count



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

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

#typesObject



62
63
64
# File 'lib/method_args/args.rb', line 62

def types
  map(&:type)
end