Sha256: 03c66810a67c4c7437a3ee0489961b9916d22cb3abaa556a222b953dbefdb959

Contents?: true

Size: 414 Bytes

Versions: 1

Compression:

Stored size: 414 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
          self.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.1.0 lib/mutator/helpers.rb