Class: FFIGen::Constant

Inherits:
Object
  • Object
show all
Defined in:
lib/ffi_gen.rb,
lib/ffi_gen/java_output.rb,
lib/ffi_gen/ruby_output.rb

Instance Method Summary collapse

Constructor Details

#initialize(generator, name, value) ⇒ Constant

Returns a new instance of Constant.



124
125
126
127
128
# File 'lib/ffi_gen.rb', line 124

def initialize(generator, name, value)
  @generator = generator
  @name = name
  @value = value
end

Instance Method Details

#write_java(writer) ⇒ Object



238
239
240
# File 'lib/ffi_gen/java_output.rb', line 238

def write_java(writer)
  writer.puts "public static int #{@name.to_java_constant} = #{@value};", ""
end

#write_ruby(writer) ⇒ Object



247
248
249
# File 'lib/ffi_gen/ruby_output.rb', line 247

def write_ruby(writer)
  writer.puts "#{@name.to_ruby_constant} = #{@value}", ""
end