custom_words 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 257f3ead9bb471f80015a325664ad38883768e01
4
- data.tar.gz: 5ef80cb05ec54771814b01e22a507a2a1904a8a0
3
+ metadata.gz: 0e624a284923929a11547ee457be381f9d3c88ea
4
+ data.tar.gz: 7c6cb1969b8fdc7498036345509217f7c12ea046
5
5
  SHA512:
6
- metadata.gz: 8bec4ee58c59d73cc8540abafb16da8bb0ca81f45e8b639959e5979d08270665cbde3b3e541efc62786c89a7dcc2721ff01c4f0b1ade8e11c05cfe85d47d2cb7
7
- data.tar.gz: 960776613605ed7d4382ba6c2982368dae546df6d6209dff4b7c4c14e9fbbf225dd3124c2aaaae3884c6170c59cd68dab84fec067d2c2242ba825f2c9ccd453b
6
+ metadata.gz: fe0419cffa435533fefb6caa01d945c16d1bd866c6a1521433e02e9ed6b1f77d6c3280f7a3cd597931ac5d6f74b8e274c41bf7b5f37751b565290ca4c15b1940
7
+ data.tar.gz: e2ed7bafe41a9c15346edecef69da517ca8832a0ba9941b222607915e6c93ba68ab9b7fb7dfc5fbc69f76634d01d82b9fcf82fe49e3323dc192244cb16ec62dc
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 João Daniel
1
+ Copyright (c) 2015 AppProva
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CustomWords
2
2
 
3
+ ![Custom Words Logo](https://raw.github.com/appprova/custom_words/master/custom_words.jpg)
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/custom_words.svg)](http://badge.fury.io/rb/custom_words)
6
+
3
7
  It allows the user to add custom words to its app.
4
8
 
5
9
  ## Installation
@@ -26,15 +30,31 @@ Add a custom word in `config/custom_words.yml` as:
26
30
  test_word: "Test word"
27
31
  ```
28
32
 
33
+ Or a nested custom word like:
34
+
35
+ ```yaml
36
+ word_group:
37
+ word_subgroup:
38
+ custom_word: 'such a nice feature'
39
+ ```
40
+
29
41
  Use this word in your view with:
30
42
 
31
43
  ```ruby
32
- <%= custom :test_word %>
44
+ <%= custom :test_word %> or
45
+ <%= custom 'test_word' %>
33
46
  ```
34
47
 
48
+ With nested custom words:
49
+
50
+ ```ruby
51
+ <%= custom 'word_group.word_subgroup.custom_word' %>
52
+ ```
53
+
54
+
35
55
  ## Contributing
36
56
 
37
- 1. Fork it ( https://github.com/[my-github-username]/custom_words/fork )
57
+ 1. Fork it ( https://github.com/appprova/custom_words/fork )
38
58
  2. Create your feature branch (`git checkout -b my-new-feature`)
39
59
  3. Commit your changes (`git commit -am 'Add some feature'`)
40
60
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,11 +1,16 @@
1
1
  module CustomWords
2
- class CustomWords
2
+ class CustomWords
3
3
 
4
- CUSTOM_WORDS = YAML.load_file('config/custom_words.yml')
4
+ CUSTOM_WORDS = YAML.load_file('config/custom_words.yml')
5
5
 
6
- def self.fetch_word key
7
- CUSTOM_WORDS.fetch(key.to_s)
8
- end
6
+ def self.fetch_word key
7
+ keys = key.to_s.split('.')
8
+ result = CUSTOM_WORDS.fetch keys.shift
9
+ keys.each do |key|
10
+ result = result.fetch key.to_s
11
+ end
12
+ result
13
+ end
9
14
 
10
- end
11
- end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module CustomWords
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  module CustomWords
2
2
  module ViewHelpers
3
3
  def custom key
4
- CustomWords.fetch_word(key)
5
- end
4
+ CustomWords.fetch_word(key)
5
+ end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: custom_words
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - João Daniel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-07 00:00:00.000000000 Z
11
+ date: 2015-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -59,12 +59,8 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - ".gitignore"
63
- - Gemfile
64
62
  - LICENSE.txt
65
63
  - README.md
66
- - Rakefile
67
- - custom_words.gemspec
68
64
  - lib/custom_words.rb
69
65
  - lib/custom_words/custom_words.rb
70
66
  - lib/custom_words/version.rb
@@ -96,3 +92,4 @@ signing_key:
96
92
  specification_version: 4
97
93
  summary: Helps user to set custom_words in yaml files and use them on the view.
98
94
  test_files: []
95
+ has_rdoc:
data/.gitignore DELETED
@@ -1,14 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in custom_words.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
@@ -1,23 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'custom_words/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "custom_words"
8
- spec.version = CustomWords::VERSION
9
- spec.authors = ["João Daniel"]
10
- spec.email = ["jdanielnd@gmail.com"]
11
- spec.summary = %q{Helps user to set custom_words in yaml files and use them on the view.}
12
- spec.homepage = "https://github.com/appprova/custom_words"
13
- spec.license = "MIT"
14
-
15
- spec.files = `git ls-files -z`.split("\x0")
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
19
-
20
- spec.add_development_dependency "bundler", "~> 1.7"
21
- spec.add_development_dependency "rake", "~> 10.0"
22
- spec.add_development_dependency "active_support", "~> 3.0"
23
- end