Class: SPQR::MethodMeta
- Inherits:
-
Struct
- Object
- Struct
- SPQR::MethodMeta
- Defined in:
- lib/spqr/manageable.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #formals_in ⇒ Object
- #formals_out ⇒ Object
-
#initialize(*a) ⇒ MethodMeta
constructor
A new instance of MethodMeta.
- #type_of(param) ⇒ Object
- #types_in ⇒ Object
- #types_out ⇒ Object
Constructor Details
#initialize(*a) ⇒ MethodMeta
Returns a new instance of MethodMeta.
57 58 59 60 61 |
# File 'lib/spqr/manageable.rb', line 57 def initialize(*a) super *a self. = (({} unless self.) or self..dup) self.args = gen_args end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args
56 57 58 |
# File 'lib/spqr/manageable.rb', line 56 def args @args end |
#description ⇒ Object
Returns the value of attribute description
56 57 58 |
# File 'lib/spqr/manageable.rb', line 56 def description @description end |
#name ⇒ Object
Returns the value of attribute name
56 57 58 |
# File 'lib/spqr/manageable.rb', line 56 def name @name end |
#options ⇒ Object
Returns the value of attribute options
56 57 58 |
# File 'lib/spqr/manageable.rb', line 56 def @options end |
Instance Method Details
#formals_in ⇒ Object
63 64 65 |
# File 'lib/spqr/manageable.rb', line 63 def formals_in self.args.select {|arg| arg.direction == :in or arg.direction == :inout}.collect{|arg| arg.name.to_s} end |
#formals_out ⇒ Object
67 68 69 |
# File 'lib/spqr/manageable.rb', line 67 def formals_out self.args.select {|arg| arg.direction == :inout or arg.direction == :out}.collect{|arg| arg.name.to_s} end |
#type_of(param) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/spqr/manageable.rb', line 79 def type_of(param) @types_for ||= self.args.inject({}) do |acc,arg| k = arg.name v = arg.kind.to_s acc[k] = v acc[k.to_s] = v acc end @types_for[param] end |
#types_in ⇒ Object
71 72 73 |
# File 'lib/spqr/manageable.rb', line 71 def types_in self.args.select {|arg| arg.direction == :in or arg.direction == :inout}.collect{|arg| arg.kind.to_s} end |
#types_out ⇒ Object
75 76 77 |
# File 'lib/spqr/manageable.rb', line 75 def types_out self.args.select {|arg| arg.direction == :inout or arg.direction == :out}.collect{|arg| arg.kind.to_s} end |