Class: Signature
- Inherits:
-
Object
- Object
- Signature
- Defined in:
- lib/compilable/signature.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
-
#retval ⇒ Object
Returns the value of attribute retval.
Class Method Summary collapse
Instance Method Summary collapse
-
#fit?(compulsory, optional, rest, block) ⇒ Boolean
Check if a signature fits in the “arity” of a method should be called sig.fit? *args where args come from instance_method(:foo).args.
-
#initialize(params, retval) ⇒ Signature
constructor
A new instance of Signature.
Constructor Details
#initialize(params, retval) ⇒ Signature
Returns a new instance of Signature.
45 46 47 |
# File 'lib/compilable/signature.rb', line 45 def initialize(params, retval) @params, @retval = params.dup, retval end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
43 44 45 |
# File 'lib/compilable/signature.rb', line 43 def params @params end |
#retval ⇒ Object
Returns the value of attribute retval.
43 44 45 |
# File 'lib/compilable/signature.rb', line 43 def retval @retval end |
Class Method Details
Instance Method Details
#fit?(compulsory, optional, rest, block) ⇒ Boolean
Check if a signature fits in the “arity” of a method should be called sig.fit? *args where args come from instance_method(:foo).args
52 53 54 |
# File 'lib/compilable/signature.rb', line 52 def fit?(compulsory, optional, rest, block) # TODO: Check for blocks compulsory.size <= params.size && compulsory.size + optional.size >= params.size #|| !rest.nil? end |