Class: SPQR::MethodMeta

Inherits:
Struct
  • Object
show all
Defined in:
lib/spqr/manageable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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.options = (({} unless self.options) or self.options.dup)
  self.args = gen_args
end

Instance Attribute Details

#argsObject

Returns the value of attribute args

Returns:

  • (Object)

    the current value of args



66
67
68
# File 'lib/spqr/manageable.rb', line 66

def args
  @args
end

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



66
67
68
# File 'lib/spqr/manageable.rb', line 66

def description
  @description
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



66
67
68
# File 'lib/spqr/manageable.rb', line 66

def name
  @name
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



66
67
68
# File 'lib/spqr/manageable.rb', line 66

def options
  @options
end

Instance Method Details

#formals_inObject



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_outObject



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_inObject



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_outObject



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