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

Fixed requiring files from lib directory ( NameError: uninitialized constant ComposableStateMachine::CallbackRunner) #1

Merged
merged 1 commit into from Jun 27, 2015

Conversation

bogdanRada
Copy link
Contributor

Hello,
First of all i want to thank you for such a great job. I love this gem .
I tried using it in one of my projects and i kept getting errors like
" NameError: uninitialized constant ComposableStateMachine::CallbackRunner " and also this happenned for all other files
although this was my code that i was using:

require 'composable_state_machine'
class Room
  MACHINE_MODEL = ComposableStateMachine.model(
      transitions: {
          heat: {cold: :warm, warm: :hot},
          cool: {warm: :cold, hot: :warm},
      }
  )

  attr_reader :temp

  def initialize(temp)
    @machine = ComposableStateMachine::MachineWithExternalState.new(
        MACHINE_MODEL, method(:temp), method(:temp=), state: temp)
  end

  def heat(periods = 1)
    periods.times { @machine.trigger(:heat) }
    self
  end

  def cool(periods = 1)
    periods.times { @machine.trigger(:cool) }
    self
  end

  private

  def temp=(new_value)
    puts " -- Temperature changed from #{temp.inspect} to #{new_value.inspect}"
    @temp = new_value
  end
end

But after changing how the files are being required from the lib directory, now everything works fine.
Let me know if it is ok or you need me to change something. Thanks.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 727125f on bogdanRada:master into 9e0e689 on swoop-inc:master.

@bogdanRada
Copy link
Contributor Author

is there any chance of getting this merged? that would really be awesome :)

@bogdanRada bogdanRada changed the title Fixed requiring files from lib directory Fixed requiring files from lib directory ( NameError: uninitialized constant ComposableStateMachine::CallbackRunner) Mar 20, 2015
@bogdanRada
Copy link
Contributor Author

any thoughts on this? I would really appreciate if someone could take a look at this. I really need this gem in one of my project and would really help me a lot . Please take a look and let me know your opinion.

@ssimeonov
Copy link
Contributor

Thanks for the contribution!

ssimeonov added a commit that referenced this pull request Jun 27, 2015
Fixed requiring files from lib directory
@ssimeonov ssimeonov merged commit 22f74a4 into swoop-inc:master Jun 27, 2015
@bogdanRada
Copy link
Contributor Author

thank you also :)

@bogdanRada
Copy link
Contributor Author

can you also please push this to rubygems? would help me a lot. Thank you very much.

@bogdanRada
Copy link
Contributor Author

any update on this? would really help me a lot if you could push this change to rubygems.org.

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

Successfully merging this pull request may close these issues.

None yet

3 participants