Skip to content

Instantly share code, notes, and snippets.

@emonti emonti/gist:279607
Created Jan 17, 2010

Embed
What would you like to do?
# copy and paste this into IRB...
#
require 'ffi'
class Foo < FFI::Struct
layout :ary, [:uint16, 10]
end
f = Foo.new
# => #<Foo:0x19bb51c>
f[:ary].class
# => FFI::Struct::InlineArray
# and something with InlineArray is broken...
f[:ary]
# NoMethodError: to_s not defined for this array type
# from /usr/lib/ruby/1.8/irb.rb:302:in `to_s'
# from /usr/lib/ruby/1.8/irb.rb:302:in `inspect'
# from /usr/lib/ruby/1.8/irb.rb:302:in `output_value'
# from /usr/lib/ruby/1.8/irb.rb:151:in `eval_input'
# from /usr/lib/ruby/1.8/irb.rb:263:in `signal_status'
# from /usr/lib/ruby/1.8/irb.rb:147:in `eval_input'
# from /usr/lib/ruby/1.8/irb/ruby-lex.rb:244:in `each_top_level_statement'
# from /usr/lib/ruby/1.8/irb/ruby-lex.rb:230:in `loop'
# from /usr/lib/ruby/1.8/irb/ruby-lex.rb:230:in `each_top_level_statement'
# from /usr/lib/ruby/1.8/irb/ruby-lex.rb:229:in `catch'
# from /usr/lib/ruby/1.8/irb/ruby-lex.rb:229:in `each_top_level_statement'
# from /usr/lib/ruby/1.8/irb.rb:146:in `eval_input'
# from /usr/lib/ruby/1.8/irb.rb:70:in `start'
# from /usr/lib/ruby/1.8/irb.rb:69:in `catch'
# from /usr/lib/ruby/1.8/irb.rb:69:in `start'
# from /usr/bin/irb:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.