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.
67 68 69 70 71 |
# File 'lib/spqr/manageable.rb', line 67 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
66 67 68 |
# File 'lib/spqr/manageable.rb', line 66 def args @args end |
#description ⇒ Object
Returns the value of attribute description
66 67 68 |
# File 'lib/spqr/manageable.rb', line 66 def description @description end |
#name ⇒ Object
Returns the value of attribute name
66 67 68 |
# File 'lib/spqr/manageable.rb', line 66 def name @name end |
#options ⇒ Object
Returns the value of attribute options
66 67 68 |
# File 'lib/spqr/manageable.rb', line 66 def @options end |
Instance Method Details
#formals_in ⇒ Object
73 74 75 |
# File 'lib/spqr/manageable.rb', line 73 def formals_in self.args.select {|arg| arg.direction == :in or arg.direction == :inout}.collect{|arg| arg.name.to_s} end |
#formals_out ⇒ Object
77 78 79 |
# File 'lib/spqr/manageable.rb', line 77 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
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/spqr/manageable.rb', line 89 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
81 82 83 |
# File 'lib/spqr/manageable.rb', line 81 def types_in self.args.select {|arg| arg.direction == :in or arg.direction == :inout}.collect{|arg| arg.kind.to_s} end |
#types_out ⇒ Object
85 86 87 |
# File 'lib/spqr/manageable.rb', line 85 def types_out self.args.select {|arg| arg.direction == :inout or arg.direction == :out}.collect{|arg| arg.kind.to_s} end |