Class: SWIG::Function
- Inherits:
-
Object
- Object
- SWIG::Function
- Defined in:
- lib/crequire/swig.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#name ⇒ Object
Returns the value of attribute name.
-
#return ⇒ Object
Returns the value of attribute return.
Instance Method Summary collapse
-
#initialize(name, args = [], ret = :void) ⇒ Function
constructor
A new instance of Function.
- #to_s ⇒ Object
- #to_swig_s ⇒ Object
Constructor Details
#initialize(name, args = [], ret = :void) ⇒ Function
Returns a new instance of Function.
81 82 83 84 85 |
# File 'lib/crequire/swig.rb', line 81 def initialize(name, args = [], ret = :void) @name = name @args = args @return = ret end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
79 80 81 |
# File 'lib/crequire/swig.rb', line 79 def args @args end |
#name ⇒ Object
Returns the value of attribute name.
79 80 81 |
# File 'lib/crequire/swig.rb', line 79 def name @name end |
#return ⇒ Object
Returns the value of attribute return.
79 80 81 |
# File 'lib/crequire/swig.rb', line 79 def return @return end |
Instance Method Details
#to_s ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/crequire/swig.rb', line 87 def to_s res = "extern #{@return} #{@name}(" res << @args.each_with_index.map do |arg,i| if arg =~ /(INPUT)|(OUTPUT)/ arg.to_s.gsub(/(INPUT)|(OUTPUT)/, "arg#{i}") else arg.to_s + " arg#{i}" end end.join(", ") res << ");" end |
#to_swig_s ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/crequire/swig.rb', line 99 def to_swig_s res = "extern #{@return} #{@name}(" res << @args.each_with_index.map do |arg,i| if arg =~ /(INPUT)|(OUTPUT)/ arg.to_s else arg.to_s + " arg#{i}" end end.join(", ") res << ");" end |