Sha256: 82a5d2a0a5d6395f146110ed6a12f2b7de080c5043f526401fd4e82e270f694a

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::#{base.name}".constantize.states.each do |state|
        base.send(:define_singleton_method, state) do
          self.where(state: state)
        end
      end
    end

  protected

    def machine_class
      "Mutator::#{self.class.name}".constantize
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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