Sha256: 54c75dda77750c0c43ec9f4790bad44d558aa2e0644366eb50409835a1ee1ba9

Contents?: true

Size: 406 Bytes

Versions: 1

Compression:

Stored size: 406 Bytes

Contents

module Mutator
  module Helpers
    def machine
      @machine ||= machine_class.new(self)
    end

    def self.included base
      Mutator.const_get(base.name, false).states.each do |state|
        base.send(:define_singleton_method, state) do
          where state: state
        end
      end
    end

  protected

    def machine_class
      Mutator.const_get self.class.name, false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mutator-0.2.0 lib/mutator/helpers.rb