Class: Pyper::Pipes::Cassandra::Writer

Inherits:
Struct
  • Object
show all
Defined in:
lib/pyper/pipes/cassandra/writer.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attribute_filter_setObject

Returns the value of attribute attribute_filter_set

Returns:

  • (Object)

    the current value of attribute_filter_set



8
9
10
# File 'lib/pyper/pipes/cassandra/writer.rb', line 8

def attribute_filter_set
  @attribute_filter_set
end

#clientObject

Returns the value of attribute client

Returns:

  • (Object)

    the current value of client



8
9
10
# File 'lib/pyper/pipes/cassandra/writer.rb', line 8

def client
  @client
end

#table_nameObject

Returns the value of attribute table_name

Returns:

  • (Object)

    the current value of table_name



8
9
10
# File 'lib/pyper/pipes/cassandra/writer.rb', line 8

def table_name
  @table_name
end

Instance Method Details

#pipe(attributes, status = {}) ⇒ Hash

Returns The original attributes.

Parameters:

  • args (Hash)

    Arguments to store in cassandra

  • status (Hash) (defaults to: {})

    The mutable status field

Returns:

  • (Hash)

    The original attributes



13
14
15
16
17
18
19
20
21
22
# File 'lib/pyper/pipes/cassandra/writer.rb', line 13

def pipe(attributes, status = {})
  attributes_to_write = if attribute_filter_set
                          attributes.select { |k,v| attribute_filter_set.member?(k) }
                        else
                          attributes
                        end

  client.insert(table_name, attributes_to_write)
  attributes
end