I am creating an openstruct in ruby and trying to access its “suppress”
attribute but I get the “LocalJumpError” but when I try any other
attribute it looks ok…
Any idea why??
irb(main):168:0>
irb(main):169:0* australia = OpenStruct.new(:country => “Australia”,
:population => 20_000_000)
=> #<OpenStruct country=“Australia”, population=20000000>
irb(main):170:0> australia = OpenStruct.new(:country => “Australia”,
:population => 20_000_000, :suppress => “suppress”)
=> #<OpenStruct country=“Australia”, population=20000000,
suppress=“suppress”>
irb(main):171:0> australia.suppress
LocalJumpError: no block given (yield)
from
/usr/lib/ruby/gems/2.1.0/gems/activesupport-3.2.17/lib/active_support/core_ext/kernel/reporting.rb:59:in
suppress' from (irb):171 from /usr/lib/ruby/gems/2.1.0/gems/railties-3.2.17/lib/rails/commands/console.rb:47:in
start’
from
/usr/lib/ruby/gems/2.1.0/gems/railties-3.2.17/lib/rails/commands/console.rb:8:in
start' from /usr/lib/ruby/gems/2.1.0/gems/railties-3.2.17/lib/rails/commands.rb:41:in
<top (required)>’
from script/rails:6:in require' from script/rails:6:in
’
irb(main):174:0> australia.population
=> 20000000