Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
arminfro opened this issue Jan 10, 2019 · 0 comments
Open

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

arminfro opened this issue Jan 10, 2019 · 0 comments

Comments

@arminfro
Copy link

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)

@arminfro arminfro changed the title Method with param type String is called on Float, results in NoMethodError Hirb::String is called with Float, results in NoMethodError Jan 10, 2019
@arminfro arminfro changed the title Hirb::String is called with Float, results in NoMethodError Hirb::String is called with Float, results in NoMethodError Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant