Skip to content

Hirb::String is called with Float, results in NoMethodError  #106

Open
@arminfro

Description

@arminfro

Description

In a Rails environment with hirb and table_print installed I get the following error when the call to table_print returns. In other words, directly after a Table has printed a NoMethodError is called from hirb. After a simple query like tp Book.all at Exploration

After the callstack is a debugger showing the Float type while being in Hirb::String

NoMethodError: undefined method `length' for 0.047255062:Float
from /data/bundle/gems/hirb-0.7.3/lib/hirb/string.rb:26:in `size'
	from /data/bundle/gems/hirb-0.7.3/lib/hirb/pager.rb:89:in `activated_by?'
	from /data/bundle/gems/hirb-0.7.3/lib/hirb/view.rb:219:in `page_output'
	from /data/bundle/gems/hirb-0.7.3/lib/hirb/view.rb:201:in `view_or_page_output'
	from /data/bundle/gems/hirb-0.7.3/lib/hirb/view.rb:187:in `output_value'
	from /usr/local/lib/ruby/2.3.0/irb.rb:490:in `block (2 levels) in eval_input'
	from /usr/local/lib/ruby/2.3.0/irb.rb:623:in `signal_status'
	from /usr/local/lib/ruby/2.3.0/irb.rb:486:in `block in eval_input'
	from /usr/local/lib/ruby/2.3.0/irb/ruby-lex.rb:246:in `block (2 levels) in each_top_level_statement'
	from /usr/local/lib/ruby/2.3.0/irb/ruby-lex.rb:232:in `loop'
	from /usr/local/lib/ruby/2.3.0/irb/ruby-lex.rb:232:in `block in each_top_level_statement'
	from /usr/local/lib/ruby/2.3.0/irb/ruby-lex.rb:231:in `catch'
	from /usr/local/lib/ruby/2.3.0/irb/ruby-lex.rb:231:in `each_top_level_statement'
	from /usr/local/lib/ruby/2.3.0/irb.rb:485:in `eval_input'
	from /usr/local/lib/ruby/2.3.0/irb.rb:395:in `block in start'
	from /usr/local/lib/ruby/2.3.0/irb.rb:394:in `catch'
	from /usr/local/lib/ruby/2.3.0/irb.rb:394:in `start'
[24, 33] in /data/bundle/gems/hirb-0.7.3/lib/hirb/string.rb
   24:     else
   25:       def size(string)
   26:         string.length
   27:       rescue
   28:         byebug
=> 29:       end
   30: 
   31:       def ljust(string, desired_length)
   32:         string.ljust(desired_length)
   33:       end
(byebug) string  # => 0.010400611
(byebug) string.class # => Float

Environment

docker image(ruby:2.3-jessie)
ruby(2.3.7)
rails (4.2.11)
table_print (1.5.6)
hirb (0.7.3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions