Sha256: 5cb00ad08da0808f09624e5887af6080dd9a6fedc183e170a9910c925a109005

Contents?: true

Size: 375 Bytes

Versions: 1

Compression:

Stored size: 375 Bytes

Contents

module MissileEmitter
  module Configurable
    
    MissileEmitter do |klass, key_field = :key, value_field = :value, key, &block|
      klass.define_singleton_method key do
        setting = find_or_create_by! key_field => key
        
        record.update(value_field => record.instance_eval(&block)) if block

        record.send value_field
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
missile_emitter-0.3.2 lib/missile_emitter/configurable.rb