Class: Cascading::BaseTap

Inherits:
Object
  • Object
show all
Defined in:
lib/cascading/tap.rb

Overview

A BaseTap wraps up a pair of Cascading taps, one for Cascading local mode and the other for Hadoop mode. Note that these are optional, but at least one must be provided for most taps. A SequenceFile is a notable example of a Scheme for which there is no Cascading local mode version, so a Tap you build with it will have no local_tap.

Direct Known Subclasses

MultiTap, Tap

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(local_tap, hadoop_tap) ⇒ BaseTap

Constructor that accepts the local_tap and hadoop_tap, which may be nil



11
12
13
14
# File 'lib/cascading/tap.rb', line 11

def initialize(local_tap, hadoop_tap)
  @local_tap = local_tap
  @hadoop_tap = hadoop_tap
end

Instance Attribute Details

#hadoop_tapObject (readonly)

Returns the value of attribute hadoop_tap.



8
9
10
# File 'lib/cascading/tap.rb', line 8

def hadoop_tap
  @hadoop_tap
end

#local_tapObject (readonly)

Returns the value of attribute local_tap.



8
9
10
# File 'lib/cascading/tap.rb', line 8

def local_tap
  @local_tap
end

Instance Method Details

#hadoop?Boolean

Returns false if the hadoop_tap is nil, true otherwise

Returns:

  • (Boolean)


27
28
29
# File 'lib/cascading/tap.rb', line 27

def hadoop?
  !hadoop_tap.nil?
end

#local?Boolean

Returns false if the local_tap is nil, true otherwise

Returns:

  • (Boolean)


22
23
24
# File 'lib/cascading/tap.rb', line 22

def local?
  !local_tap.nil?
end

#to_sObject

Passes through printing the local_tap and hadoop_tap



17
18
19
# File 'lib/cascading/tap.rb', line 17

def to_s
  "Local: #{local_tap}, Hadoop: #{hadoop_tap}"
end