Module: Dynomite::Migration::Dsl::Accessor

Included in:
Dynomite::Migration::Dsl
Defined in:
lib/dynomite/migration/dsl/accessor.rb

Instance Method Summary collapse

Instance Method Details

#define_dsl_accessor(name) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/dynomite/migration/dsl/accessor.rb', line 9

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

#dsl_accessor(*names) ⇒ Object



3
4
5
6
7
# File 'lib/dynomite/migration/dsl/accessor.rb', line 3

def dsl_accessor(*names)
  names.each do |name|
    define_dsl_accessor(name)
  end
end