html_tables 0.0.1 → 0.0.2

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.
data/CHANGELOG ADDED
@@ -0,0 +1,7 @@
1
+ 0.0.2
2
+ -----
3
+ * Added `to_label` method for `NilClass` and `ActiveRecord::Base`.
4
+
5
+ 0.0.1
6
+ -----
7
+ * Initial version
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ module ToLabel
4
+ # override this method on subclasses as needed
5
+ def to_label(*args)
6
+ [:name, :code, :nome, :codigo].each do |m|
7
+ return public_send(m) if respond_to?(m)
8
+ end
9
+ to_s
10
+ end
11
+ end
12
+
13
+ ActiveRecord::Base.send(:include, ToLabel)
14
+
15
+ class NilClass
16
+ def to_label(*args)
17
+ nil
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module HtmlTables
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
data/lib/html_tables.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'html_tables/version'
4
4
 
5
+ require 'html_tables/to_label'
5
6
  require 'html_tables/format_for_output'
6
7
  require 'html_tables/yielded_object'
7
8
  require 'html_tables/data_table'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_tables
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-13 00:00:00.000000000 Z
12
+ date: 2012-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
@@ -83,6 +83,7 @@ extensions: []
83
83
  extra_rdoc_files: []
84
84
  files:
85
85
  - .gitignore
86
+ - CHANGELOG
86
87
  - Gemfile
87
88
  - LICENSE
88
89
  - README.md
@@ -93,6 +94,7 @@ files:
93
94
  - lib/html_tables/data_table_helper.rb
94
95
  - lib/html_tables/format_for_output.rb
95
96
  - lib/html_tables/railtie.rb
97
+ - lib/html_tables/to_label.rb
96
98
  - lib/html_tables/version.rb
97
99
  - lib/html_tables/yielded_object.rb
98
100
  homepage: http://elementarsistemas.com.br/