Class: Chicago::ETL::StageName Private

Inherits:
Object
  • Object
show all
Defined in:
lib/chicago/etl/stage_name.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A namespaced name for an ETL stage.

Instance Method Summary collapse

Constructor Details

#initialize(*names) ⇒ StageName

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of StageName.



7
8
9
10
11
12
13
# File 'lib/chicago/etl/stage_name.rb', line 7

def initialize(*names)
  if names.size == 1 && names.first.kind_of?(String)
    @names = names.first.split(".").map(&:to_sym).freeze
  else
    @names = names.flatten.map(&:to_sym).freeze
  end
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


33
34
35
# File 'lib/chicago/etl/stage_name.rb', line 33

def eql?(other)
  to_s == other.to_s
end

#hashObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



38
39
40
# File 'lib/chicago/etl/stage_name.rb', line 38

def hash
  to_s.hash
end

#match?(*pattern) ⇒ Boolean Also known as: =~

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


19
20
21
22
23
24
25
26
# File 'lib/chicago/etl/stage_name.rb', line 19

def match?(*pattern)
  pattern.flatten!
  return false if pattern.size > @names.size

  pattern.each_with_index.all? do |part, i|
    part == :* || @names[i] == part
  end
end

#nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
# File 'lib/chicago/etl/stage_name.rb', line 15

def name
  @names.last
end

#namespaceObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/chicago/etl/stage_name.rb', line 29

def namespace
  @names[0...(@names.size - 1)]
end

#to_aObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
# File 'lib/chicago/etl/stage_name.rb', line 42

def to_a
  @names.dup
end

#to_sObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



46
47
48
# File 'lib/chicago/etl/stage_name.rb', line 46

def to_s
  @string_representation ||= @names.join('.')
end