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.



57
58
59
60
61
# File 'lib/spqr/manageable.rb', line 57

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



56
57
58
# File 'lib/spqr/manageable.rb', line 56

def args
  @args
end

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



56
57
58
# File 'lib/spqr/manageable.rb', line 56

def description
  @description
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



56
57
58
# File 'lib/spqr/manageable.rb', line 56

def name
  @name
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



56
57
58
# File 'lib/spqr/manageable.rb', line 56

def options
  @options
end

Instance Method Details

#formals_inObject



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_outObject



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_inObject



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_outObject



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