cheerio 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.
- checksums.yaml +4 -4
- data/lib/cheerio.rb +16 -2
- data/lib/cheerio/version.rb +1 -1
- data/lib/locales/en.yml +23 -6
- data/lib/locales/es.yml +7 -0
- data/spec/lib/cheerio_spec.rb +6 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3cfbb7797ee7dec38d1244aa172c50783c9b872
|
4
|
+
data.tar.gz: 0f3d5e89e90ef94c3c68eac37a0c6fba7b5b4e87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 043fcc4d9770423b40cfe3ce39d9d9101807e48d103ca3bcb0276e5adb5a0ca690d67763c7ef608601c472a3349ac07349872df6c044edb134588e5af446ada8
|
7
|
+
data.tar.gz: 1ccac2ea0e6e874118cf9fa404f2ff3a4181b1b5c92fe44d8cbe1054e5a11f9631f1b75ca7150fc2d563ad2569e8451f4347938ad73d88d99459a18152be8506
|
data/lib/cheerio.rb
CHANGED
@@ -4,11 +4,25 @@ require "i18n"
|
|
4
4
|
I18n.load_path = Dir[File.dirname(__FILE__) + '/locales/*.{rb,yml}']
|
5
5
|
|
6
6
|
module Cheerio
|
7
|
+
@locale = :en
|
8
|
+
|
9
|
+
class << self
|
10
|
+
attr_accessor :locale
|
11
|
+
end
|
12
|
+
|
7
13
|
def self.hello
|
8
|
-
I18n.t('salutations').sample
|
14
|
+
I18n.t('salutations', self.I18n_options).sample
|
9
15
|
end
|
10
16
|
|
11
17
|
def self.goodbye
|
12
|
-
I18n.t('valedictations').sample
|
18
|
+
I18n.t('valedictations', self.I18n_options).sample
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def self.I18n_options
|
24
|
+
{
|
25
|
+
locale: @locale
|
26
|
+
}
|
13
27
|
end
|
14
28
|
end
|
data/lib/cheerio/version.rb
CHANGED
data/lib/locales/en.yml
CHANGED
@@ -1,14 +1,31 @@
|
|
1
1
|
en:
|
2
2
|
compliments:
|
3
|
+
- "Good to see you."
|
4
|
+
- "Nice to see you."
|
3
5
|
- "You look nice today."
|
4
|
-
- "Nice work."
|
5
6
|
- "You're swell."
|
7
|
+
- "You've done well."
|
8
|
+
- "We're impressed by you."
|
6
9
|
salutations:
|
7
|
-
- "
|
10
|
+
- "Greetings"
|
11
|
+
- "Welcome."
|
8
12
|
- "Hello."
|
9
|
-
- "
|
13
|
+
- "Hey there!"
|
14
|
+
- "Hey!"
|
15
|
+
- "How's it going?"
|
16
|
+
- "Howdy."
|
17
|
+
- "Look who it is!"
|
18
|
+
- "Well hello!"
|
19
|
+
- "What's up?"
|
20
|
+
- "Why hello there."
|
10
21
|
valedictations:
|
11
|
-
- "
|
22
|
+
- "Bye!"
|
12
23
|
- "Farewell"
|
13
|
-
- "
|
14
|
-
- "
|
24
|
+
- "Goodbye"
|
25
|
+
- "Have a great day."
|
26
|
+
- "Have a good day."
|
27
|
+
- "Later!"
|
28
|
+
- "See you later."
|
29
|
+
- "See you soon!"
|
30
|
+
- "Take care."
|
31
|
+
- "Until next time."
|
data/lib/locales/es.yml
ADDED
data/spec/lib/cheerio_spec.rb
CHANGED
@@ -10,4 +10,10 @@ describe Cheerio do
|
|
10
10
|
valedication = Cheerio.goodbye
|
11
11
|
valedication.should_not be_nil
|
12
12
|
end
|
13
|
+
|
14
|
+
it "supports multiple language locales" do
|
15
|
+
Cheerio.locale = :es
|
16
|
+
salutation_in_spanish = Cheerio.hello
|
17
|
+
salutation_in_spanish.should_not be_nil
|
18
|
+
end
|
13
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cheerio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Rocher
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- lib/cheerio.rb
|
83
83
|
- lib/cheerio/version.rb
|
84
84
|
- lib/locales/en.yml
|
85
|
+
- lib/locales/es.yml
|
85
86
|
- spec/lib/cheerio_spec.rb
|
86
87
|
- spec/spec_helper.rb
|
87
88
|
homepage: https://github.com/rochers/cheerio
|