Class: DataImport::Dsl::Import::From

Inherits:
Object
  • Object
show all
Defined in:
lib/data-import/dsl/import/from.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition) ⇒ From

Returns a new instance of From.



8
9
10
# File 'lib/data-import/dsl/import/from.rb', line 8

def initialize(definition)
  @definition = definition
end

Instance Attribute Details

#definitionObject (readonly)

Returns the value of attribute definition.



6
7
8
# File 'lib/data-import/dsl/import/from.rb', line 6

def definition
  @definition
end

Instance Method Details

#columns(*args) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/data-import/dsl/import/from.rb', line 20

def columns(*args)
  if args.last.is_a? Hash
    options = args.pop
    definition.source_distinct_columns = options[:distinct]
  end
  definition.source_columns |= args
end

#order(*args) ⇒ Object



28
29
30
# File 'lib/data-import/dsl/import/from.rb', line 28

def order(*args)
  definition.source_order_columns |= args
end

#primary_key(name) ⇒ Object



16
17
18
# File 'lib/data-import/dsl/import/from.rb', line 16

def primary_key(name)
  definition.source_primary_key = name
end

#table(name) ⇒ Object



12
13
14
# File 'lib/data-import/dsl/import/from.rb', line 12

def table(name)
  definition.source_table_name = name
end