simple_table 0.0.12 → 0.0.13

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.
@@ -2,12 +2,15 @@ module SimpleTable
2
2
  class Cell < Tag
3
3
  self.level = 3
4
4
 
5
- attr_reader :content
6
-
7
5
  def initialize(parent, content = nil, options = {})
8
6
  super(parent, options)
9
7
  @content = content
10
8
  options[:colspan] = table.columns.size if options[:colspan] == :all
9
+ yield self if block_given?
10
+ end
11
+
12
+ def content
13
+ table.view && @content.is_a?(Symbol) ? table.view.t(@content) : @content
11
14
  end
12
15
 
13
16
  def render
@@ -18,4 +21,4 @@ module SimpleTable
18
21
  parent.head? ? :th : :td
19
22
  end
20
23
  end
21
- end
24
+ end
@@ -6,11 +6,9 @@ module SimpleTable
6
6
  attr_reader :cells
7
7
 
8
8
  def initialize(parent, record = nil, options = {}, &block)
9
- super(parent, options)
10
-
11
9
  @parent = parent
10
+ @options = options
12
11
  @cells = []
13
- @block = block
14
12
 
15
13
  yield(*[self, record].compact) if block_given?
16
14
  end
@@ -5,8 +5,8 @@ module SimpleTable
5
5
  attr_reader :rows
6
6
 
7
7
  def initialize(parent, options = {})
8
- super
9
8
  @rows = []
9
+ super
10
10
  end
11
11
 
12
12
  def empty?
@@ -23,4 +23,4 @@ module SimpleTable
23
23
  super(rows.map(&:render))
24
24
  end
25
25
  end
26
- end
26
+ end
@@ -12,15 +12,13 @@ module SimpleTable
12
12
  @collection_name = options.delete(:collection_name).to_s if options.key?(:collection_name)
13
13
 
14
14
  super(nil, options.reverse_merge(:id => collection_name, :class => "#{collection_name} list"))
15
-
16
- yield(self) if block_given?
17
15
  end
18
16
 
19
17
  ['head', 'body', 'foot'].each do |name|
20
18
  class_eval <<-code
21
- def #{name} # def head
22
- @#{name} ||= #{name.classify}.new(self) # @head ||= Head.new(self)
23
- end # end
19
+ def #{name}(*args, &block) # def head(*args, &block)
20
+ @#{name} ||= #{name.classify}.new(self, *args, &block) # @head ||= Head.new(self, *args, &block)
21
+ end # end
24
22
  code
25
23
  end
26
24
 
@@ -11,6 +11,7 @@ module SimpleTable
11
11
  def initialize(parent = nil, options = {})
12
12
  @parent = parent
13
13
  @options = options
14
+ yield self if block_given?
14
15
  end
15
16
 
16
17
  def collection_class
@@ -62,4 +63,4 @@ module SimpleTable
62
63
  end
63
64
  end
64
65
  end
65
- end
66
+ end
@@ -1,3 +1,3 @@
1
1
  module SimpleTable
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.13'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_table
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease: false
4
+ hash: 5
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 12
10
- version: 0.0.12
9
+ - 13
10
+ version: 0.0.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sven Fuchs
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-10 00:00:00 +01:00
19
+ date: 2011-01-11 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  requirements: []
116
116
 
117
117
  rubyforge_project: "[none]"
118
- rubygems_version: 1.3.7
118
+ rubygems_version: 1.4.2
119
119
  signing_key:
120
120
  specification_version: 3
121
121
  summary: "[summary]"