Sha256: 49960e2ca46950cee4a495882e6034f726bd88809b943eb04c37a38afee2bfff

Contents?: true

Size: 405 Bytes

Versions: 4

Compression:

Stored size: 405 Bytes

Contents

class Dynomite::Migration::Dsl
  module Accessor
    def dsl_accessor(*names)
      names.each do |name|
        define_dsl_accessor(name)
      end
    end

    def define_dsl_accessor(name)
      define_method(name) do |*args|
        if args.empty?
          instance_variable_get("@#{name}")
        else
          instance_variable_set("@#{name}", args.first)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dynomite-2.0.3 lib/dynomite/migration/dsl/accessor.rb
dynomite-2.0.2 lib/dynomite/migration/dsl/accessor.rb
dynomite-2.0.1 lib/dynomite/migration/dsl/accessor.rb
dynomite-2.0.0 lib/dynomite/migration/dsl/accessor.rb