custom_words 0.0.1 → 0.1.0
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.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +22 -2
- data/lib/custom_words/custom_words.rb +12 -7
- data/lib/custom_words/version.rb +1 -1
- data/lib/custom_words/view_helpers.rb +2 -2
- metadata +3 -6
- data/.gitignore +0 -14
- data/Gemfile +0 -4
- data/Rakefile +0 -2
- data/custom_words.gemspec +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e624a284923929a11547ee457be381f9d3c88ea
|
4
|
+
data.tar.gz: 7c6cb1969b8fdc7498036345509217f7c12ea046
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe0419cffa435533fefb6caa01d945c16d1bd866c6a1521433e02e9ed6b1f77d6c3280f7a3cd597931ac5d6f74b8e274c41bf7b5f37751b565290ca4c15b1940
|
7
|
+
data.tar.gz: e2ed7bafe41a9c15346edecef69da517ca8832a0ba9941b222607915e6c93ba68ab9b7fb7dfc5fbc69f76634d01d82b9fcf82fe49e3323dc192244cb16ec62dc
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# CustomWords
|
2
2
|
|
3
|
+

|
4
|
+
|
5
|
+
[](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/
|
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
|
-
|
2
|
+
class CustomWords
|
3
3
|
|
4
|
-
|
4
|
+
CUSTOM_WORDS = YAML.load_file('config/custom_words.yml')
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
-
|
11
|
-
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/custom_words/version.rb
CHANGED
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
|
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-
|
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
data/Gemfile
DELETED
data/Rakefile
DELETED
data/custom_words.gemspec
DELETED
@@ -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
|