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

Version 0.1.2 breaks in Ruby 1.8 #65

Closed
geoffgarside opened this issue Oct 16, 2012 · 3 comments
Closed

Version 0.1.2 breaks in Ruby 1.8 #65

geoffgarside opened this issue Oct 16, 2012 · 3 comments

Comments

@geoffgarside
Copy link
Collaborator

Version 1.8 doesn't support Symbol#empty? as 1.8 doesn't support :"" as a symbol name.

NoMethodError: undefined method `empty?' for :pending:Symbol
from ..snipped../bundle/ruby/1.8/gems/transitions-0.1.2/lib/transitions.rb:82:in `current_state'

I suppose the easiest fix would be including some code like

begin
  :symbol.empty?
rescue NoMethodError
  class Symbol
    def empty?
      to_s.empty?
    end
  end
end

alternatively if you were to only include the code for Ruby 1.8 then this would suffice as an empty symbol is not possible in 1.8

class Symbol
  def empty?
    false
  end
end
@troessner
Copy link
Owner

Thanks for this report, however I am highly reluctant to monkeypatch one of ruby's core classes..:)

As far as I can see this commit should fix it: 0be93ff

Let me know it this works for and if yes, I'm gonna release a new gem version.

@geoffgarside
Copy link
Collaborator Author

Thats understandable, I don't usually, but as most gems are gearing towards 1.9 as the default its sometimes more desirable to have a file of backport fixes for the bits you need.

Yep, your commit tests fine for me in 1.8 and 1.9 thank you kindly :)

@troessner
Copy link
Owner

Alright, 1.0.3 is released..:)

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

2 participants