Class: Moe::Sequence::MetadataItem

Inherits:
Struct
  • Object
show all
Defined in:
lib/moe/sequence/metadata_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#countObject

Returns the value of attribute count

Returns:

  • (Object)

    the current value of count



3
4
5
# File 'lib/moe/sequence/metadata_item.rb', line 3

def count
  @count
end

#owner_idObject

Returns the value of attribute owner_id

Returns:

  • (Object)

    the current value of owner_id



3
4
5
# File 'lib/moe/sequence/metadata_item.rb', line 3

def owner_id
  @owner_id
end

#payloadObject

Returns the value of attribute payload

Returns:

  • (Object)

    the current value of payload



3
4
5
# File 'lib/moe/sequence/metadata_item.rb', line 3

def payload
  @payload
end

#table_nameObject

Returns the value of attribute table_name

Returns:

  • (Object)

    the current value of table_name



3
4
5
# File 'lib/moe/sequence/metadata_item.rb', line 3

def table_name
  @table_name
end

#uidObject

Returns the value of attribute uid

Returns:

  • (Object)

    the current value of uid



3
4
5
# File 'lib/moe/sequence/metadata_item.rb', line 3

def uid
  @uid
end

Instance Method Details

#itemsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/moe/sequence/metadata_item.rb', line 5

def items
  fetcher   = ItemFetcher.new table_name, owner_id, uid
  remaining = count

  while remaining > Moe.config.batch_limit
    fetcher.fetch Moe.config.batch_limit

    remaining -= Moe.config.batch_limit
  end

  fetcher.fetch remaining

  fetcher.items
end