twb 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Komodo Project File - DO NOT EDIT -->
3
+ <project id="887c8573-579f-4918-904e-b93029547076" kpf_version="5" name="Twb Gem.komodoproject">
4
+ <preference-set idref="887c8573-579f-4918-904e-b93029547076" id="project" preftype="project">
5
+ <long id="prefs_version">1</long>
6
+ </preference-set>
7
+ </project>
data/lib/twb.rb CHANGED
@@ -29,6 +29,6 @@ require_relative 'twb/worksheet'
29
29
  # Represents Tableau Workbooks and their contents.
30
30
  #
31
31
  module Twb
32
- VERSION = '0.1.0'
32
+ VERSION = '0.1.1'
33
33
  end
34
34
 
@@ -30,7 +30,8 @@ module Twb
30
30
  @hidden = @node.attr('hidden')
31
31
  @caption = @node.attr('caption')
32
32
  @aggregation = @node.attr('aggregation')
33
- @uiname = if @caption.nil? || @caption == '' then @name else @caption end
33
+ @uiname = if @caption.nil? || @caption == '' then @name.gsub(/^\[/,'').gsub(/\]$/,'') else @caption end
34
+ puts "\t\t - n:#{@name} \t c:#{@caption} \t n:#{@uiname}"
34
35
  return self
35
36
  end
36
37
 
@@ -21,7 +21,7 @@ module Twb
21
21
 
22
22
  class LocalField
23
23
 
24
- attr_reader :type, :node, :name, :datatype, :role, :type, :hidden, :caption, :aggregation, :uiname, :calculation
24
+ attr_reader :type, :node, :name, :datatype, :role, :type, :hidden, :caption, :aggregation, :uiname, :calculation, :comments
25
25
 
26
26
  def initialize fieldNode
27
27
  @node = fieldNode
@@ -33,13 +33,30 @@ module Twb
33
33
  @hidden = @node.attr('hidden')
34
34
  @caption = @node.attr('caption')
35
35
  @aggregation = @node.attr('aggregation')
36
- @calculation = getCalculation(node)
37
- @uiname = if @caption.nil? || @caption == '' then @name else @caption end
36
+ @calculation = getCalculation
37
+ @comments = getComments
38
+ @uiname = if @caption.nil? || @caption == '' then @name.gsub(/^\[/,'').gsub(/\]$/,'') else @caption end
38
39
  return self
39
40
  end
40
41
 
41
- def getCalculation node
42
- FieldCalculation.new(node.at_xpath("./calculation"))
42
+ def getCalculation
43
+ calcNode = @node.at_xpath("./calculation")
44
+ FieldCalculation.new(calcNode) unless calcNode.nil?
45
+ end
46
+
47
+ def getComments
48
+ comments = ''
49
+ runs = node.xpath('./desc/formatted-text/run')
50
+ runs.each do |run|
51
+ unless run.nil?
52
+ comments += run.text
53
+ end
54
+ end
55
+ return comments
56
+ end
57
+
58
+ def remove_attribute attribute
59
+ @node.remove_attribute(attribute)
43
60
  end
44
61
 
45
62
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -56,6 +56,7 @@ files:
56
56
  - test/testTwbWrite.rb
57
57
  - test/UpLeftArrowsNav.png
58
58
  - test/Web Page Dashboards.twb
59
+ - Twb Gem.komodoproject
59
60
  - twb-0.0.32.gem
60
61
  - twb-0.0.33.gem
61
62
  - twb-0.0.34.gem
@@ -63,6 +64,7 @@ files:
63
64
  - twb-0.0.36.gem
64
65
  - twb-0.0.37.gem
65
66
  - twb-0.0.38.gem
67
+ - twb-0.1.0.gem
66
68
  - twb.gemspec
67
69
  homepage: http://rubygems.org/gems/twb
68
70
  licenses: