human_attribute 0.0.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.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in human_attribute.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "human_attribute/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "human_attribute"
7
+ s.version = HumanAttribute::VERSION
8
+ s.authors = ["Alexander Balashov"]
9
+ # s.email = [""]
10
+ s.homepage = "http://github.com/divineforest/human_attribute"
11
+ s.summary = %q{Translate model attribute values from locales}
12
+ # s.description = %q{TODO: Write a gem description}
13
+
14
+ s.rubyforge_project = "human_attribute"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ end
@@ -0,0 +1,5 @@
1
+ require "human_attribute/version"
2
+ require "human_attribute/active_record/base"
3
+
4
+ module HumanAttribute
5
+ end
@@ -0,0 +1,14 @@
1
+ module ActiveRecord
2
+ class Base
3
+
4
+ def human_value(attribute_name)
5
+ value = send(attribute_name)
6
+ if value.present?
7
+ I18n.t(value, :scope => "activerecord.attribute_values.#{self.class.name.downcase}.#{attribute_name}")
8
+ else
9
+ value
10
+ end
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module HumanAttribute
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: human_attribute
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Alexander Balashov
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-11-11 00:00:00 +04:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description:
22
+ email:
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - .gitignore
31
+ - Gemfile
32
+ - Rakefile
33
+ - human_attribute.gemspec
34
+ - lib/human_attribute.rb
35
+ - lib/human_attribute/active_record/base.rb
36
+ - lib/human_attribute/version.rb
37
+ has_rdoc: true
38
+ homepage: http://github.com/divineforest/human_attribute
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ segments:
51
+ - 0
52
+ version: "0"
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project: human_attribute
63
+ rubygems_version: 1.3.6
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Translate model attribute values from locales
67
+ test_files: []
68
+