Class: TableSaw::Manifest::HasManyEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/table_saw/manifest.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, options) ⇒ HasManyEntry

Returns a new instance of HasManyEntry.



23
24
25
26
# File 'lib/table_saw/manifest.rb', line 23

def initialize(table, options)
  @table = table
  @options = options || {}
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



21
22
23
# File 'lib/table_saw/manifest.rb', line 21

def options
  @options
end

#tableObject (readonly)

Returns the value of attribute table.



21
22
23
# File 'lib/table_saw/manifest.rb', line 21

def table
  @table
end

Class Method Details

.build(config) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/table_saw/manifest.rb', line 9

def self.build(config)
  config.each_with_object({}) do |(table, options), memo|
    case table
    when String
      memo[table] = new(table, options)
    when Hash
      table, options = table.first
      memo[table] = new(table, options)
    end
  end
end

Instance Method Details

#limitObject



32
33
34
# File 'lib/table_saw/manifest.rb', line 32

def limit
  options['limit']
end

#scopeObject



28
29
30
# File 'lib/table_saw/manifest.rb', line 28

def scope
  options['scope']
end