Class: Flow::Flow

Inherits:
TabClass
  • Object
show all
Defined in:
lib/tfl/Flow.rb

Overview

A Tableau Prep Flow file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tflWithDir) ⇒ Flow

Creates a Flow from its file name.

Parameters:

flowWithDir

The Flow's file name, the Flow can be a TWB or TWBX file.

Raises:

  • (ArgumentError)


47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/tfl/Flow.rb', line 47

def initialize tflWithDir
  raise ArgumentError.new("ERROR in Flow creation: '#{tflWithDir}' must be a String, is a #{tflWithDir.class} \n ")    unless tflWithDir.is_a? String
  raise ArgumentError.new("ERROR in Flow creation: '#{tflWithDir}' must have an extension of .tfl or .tflx \n ")       unless tflWithDir.upcase.end_with?(".TFL", ".TFLX")
  raise ArgumentError.new("ERROR in Flow creation: '#{tflWithDir}' must must be a file, is a Directory\\Folder \n ")   if File.directory?(tflWithDir)
  raise ArgumentError.new("ERROR in Flow creation: '#{tflWithDir}' cannot be found, must be a Tableau Flow file. \n ") unless File.file?(tflWithDir)
  @valid = false
  if File.file?(tflWithDir) then
    @name    = File.basename(tflWithDir)
    @dir     = File.dirname(File.expand_path(tflWithDir))
    @modtime = File.new(tflWithDir).mtime.strftime("%Y-%m-%d %H:%M:%S")
    case File.extname(tflWithDir).downcase
      when '.tlf'  then processTFL(tflWithDir)
      when '.tflx' then processTFLX(flowWithDir)
    end
  end
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



29
30
31
# File 'lib/tfl/Flow.rb', line 29

def base
  @base
end

#buildObject (readonly)

Returns the value of attribute build.



29
30
31
# File 'lib/tfl/Flow.rb', line 29

def build
  @build
end

#datasource(name) ⇒ Object (readonly)



32
33
34
# File 'lib/tfl/Flow.rb', line 32

def datasource
  @datasource
end

#datasourceNamesObject (readonly)

Returns the value of attribute datasourceNames.



33
34
35
# File 'lib/tfl/Flow.rb', line 33

def datasourceNames
  @datasourceNames
end

#dataSourceNamesMapObject (readonly)

Returns the value of attribute dataSourceNamesMap.



33
34
35
# File 'lib/tfl/Flow.rb', line 33

def dataSourceNamesMap
  @dataSourceNamesMap
end

#datasourcesObject (readonly)



32
33
34
# File 'lib/tfl/Flow.rb', line 32

def datasources
  @datasources
end

#datasourceUINamesObject (readonly)

Returns the value of attribute datasourceUINames.



33
34
35
# File 'lib/tfl/Flow.rb', line 33

def datasourceUINames
  @datasourceUINames
end

#dirObject (readonly)

Returns the value of attribute dir.



28
29
30
# File 'lib/tfl/Flow.rb', line 28

def dir
  @dir
end

#modtimeObject (readonly)

Returns the value of attribute modtime.



28
29
30
# File 'lib/tfl/Flow.rb', line 28

def modtime
  @modtime
end

#nameObject (readonly)

Returns the value of attribute name.



28
29
30
# File 'lib/tfl/Flow.rb', line 28

def name
  @name
end

#platformObject (readonly)

Returns the value of attribute platform.



29
30
31
# File 'lib/tfl/Flow.rb', line 29

def platform
  @platform
end

#rootObject (readonly)

Returns the value of attribute root.



30
31
32
# File 'lib/tfl/Flow.rb', line 30

def root
  @root
end

#typeObject (readonly)

Returns the value of attribute type.



28
29
30
# File 'lib/tfl/Flow.rb', line 28

def type
  @type
end

#versionObject (readonly)

Returns the value of attribute version.



29
30
31
# File 'lib/tfl/Flow.rb', line 29

def version
  @version
end

Instance Method Details

#actionNamesObject



104
105
106
# File 'lib/tfl/Flow.rb', line 104

def actionNames
  @actions.keys
end

#actionsObject



100
101
102
# File 'lib/tfl/Flow.rb', line 100

def actions
  @actions.values
end

#dashboard(name) ⇒ Object



96
97
98
# File 'lib/tfl/Flow.rb', line 96

def dashboard name
  @dashboards[name]
end

#dashboardNamesObject



92
93
94
# File 'lib/tfl/Flow.rb', line 92

def dashboardNames
  @dashboards.keys
end

#dashboardsObject



88
89
90
# File 'lib/tfl/Flow.rb', line 88

def dashboards
  @dashboards.values
end

#idObject



64
65
66
# File 'lib/tfl/Flow.rb', line 64

def id
    @id ||= @id = @name.hash
end

#orphanDataSourcesObject



116
117
118
# File 'lib/tfl/Flow.rb', line 116

def orphanDataSources
  @orphanDataSources ||= identifyOrphandatasoUrceS
end

#parametersObject



112
113
114
# File 'lib/tfl/Flow.rb', line 112

def parameters
  @parameters ||= loadParameters
end

#releaseObject



72
73
74
# File 'lib/tfl/Flow.rb', line 72

def release
  @build ||= loadBuild
end

#storyboard(name) ⇒ Object



128
129
130
# File 'lib/tfl/Flow.rb', line 128

def storyboard name
  @storyboards[name]
end

#storyboardNamesObject



124
125
126
# File 'lib/tfl/Flow.rb', line 124

def storyboardNames
  @storyboards.keys
end

#storyboardsObject



120
121
122
# File 'lib/tfl/Flow.rb', line 120

def storyboards
  @storyboards.values
end

#worksheet(name) ⇒ Object



80
81
82
# File 'lib/tfl/Flow.rb', line 80

def worksheet name
  @worksheets[name]
end

#worksheetNamesObject



84
85
86
# File 'lib/tfl/Flow.rb', line 84

def worksheetNames
  @worksheets.keys
end

#worksheetsObject



76
77
78
# File 'lib/tfl/Flow.rb', line 76

def worksheets
  @worksheets.values
end