Class: MethodArgs::Args
- Inherits:
-
Array
- Object
- Array
- MethodArgs::Args
- Defined in:
- lib/method_args/args.rb
Defined Under Namespace
Classes: Arg
Instance Attribute Summary collapse
-
#owning_method ⇒ Object
Returns the value of attribute owning_method.
Instance Method Summary collapse
- #clone ⇒ Object
- #cls ⇒ Object
-
#initialize(cls) ⇒ Args
constructor
A new instance of Args.
- #names ⇒ Object
- #required_size ⇒ Object (also: #required_count)
- #types ⇒ Object
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_method ⇒ Object
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
#clone ⇒ Object
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 |
#cls ⇒ Object
43 44 45 |
# File 'lib/method_args/args.rb', line 43 def cls @cls.inject(Module) {|c, m| c.const_get(m)} end |
#names ⇒ Object
58 59 60 |
# File 'lib/method_args/args.rb', line 58 def names map(&:name) end |
#required_size ⇒ Object 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 |
#types ⇒ Object
62 63 64 |
# File 'lib/method_args/args.rb', line 62 def types map(&:type) end |