celsius 0.4.1 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c5d32b578f85a2e0fc6375d76348d545ec103fb
4
- data.tar.gz: 8808342fa762eda0cf8dba9eea427945fd8a0255
3
+ metadata.gz: 51d18c66a638073d31c3392e942b08260ac40872
4
+ data.tar.gz: 636b788e0c5b6694e2deaabd448783e0a895ca48
5
5
  SHA512:
6
- metadata.gz: 4910cc3d48e6ad488cebedaf7cf9a4b5c9b57c12ada486d62b4ced776643fad6cdafab6018b464d5b06e01808130d2bfe91f6d264e6b45cfaaa7e4f3c6d189db
7
- data.tar.gz: 74827774d03aa7a2bbe810cf6735fd37f2e67da69531a035245c3f93980951ad911f4fa2adeb7115aa28254c05d5e96bf6f2d9c024fb678f45a26489d73ced0e
6
+ metadata.gz: 7f954d3a106089d44185eb6b87ed302943d643c87938d6a02c6af6c9f883e38fd908d62fc3cadc35267cc8365518d5c203b84262bfda46e90575245af525b279
7
+ data.tar.gz: 7db89458a190f22d27bcd7407b5fe6703488c17ba200c0ad342c6d63b89c60846f17577e4c8ab0504bbe77c9fd8e0f51713c99d07555c0ae2b382ae813e5d5d5
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "2.2.0"
4
- addons:
5
- code_climate:
6
- repo_token: 61fdb22b9d91351ec7ab58dc8b544cd4858fe63b34fc2174165432f0559fecac
3
+ - "2.0"
4
+ - "2.1"
5
+ - "2.2"
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # Celsius [![Build Status](https://travis-ci.org/ubpb/celsius.svg?branch=master)](https://travis-ci.org/ubpb/celsius) [![Test Coverage](https://codeclimate.com/github/ubpb/celsius/badges/coverage.svg)](https://codeclimate.com/github/ubpb/celsius) [![Code Climate](https://codeclimate.com/github/ubpb/celsius/badges/gpa.svg)](https://codeclimate.com/github/ubpb/celsius)
1
+ # Celsius
2
+
3
+ [![Build Status](https://travis-ci.org/ubpb/celsius.svg?branch=master)](https://travis-ci.org/ubpb/celsius)
4
+ [![Test Coverage](https://codeclimate.com/github/ubpb/celsius/badges/coverage.svg)](https://codeclimate.com/github/ubpb/celsius)
5
+ [![Code Climate](https://codeclimate.com/github/ubpb/celsius/badges/gpa.svg)](https://codeclimate.com/github/ubpb/celsius)
2
6
 
3
7
  TODO: Write a gem description
4
8
 
data/lib/celsius/hash.rb CHANGED
@@ -32,6 +32,11 @@ module Celsius::Hash
32
32
  end
33
33
  end
34
34
 
35
+ def self.smart_fetch(hash, key)
36
+ result = hash[key.to_s]
37
+ result = hash[key.to_sym] if result.nil?
38
+ end
39
+
35
40
  def self.smart_store(hash, key, value)
36
41
  if hash[key]
37
42
  unless hash[key].is_a?(Array)
@@ -1,3 +1,3 @@
1
1
  module Celsius
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -58,6 +58,21 @@ describe Celsius::Hash do
58
58
  end
59
59
  end
60
60
 
61
+ describe ".smart_fetch" do
62
+ let(:hash) do
63
+ {
64
+ foo: "bar",
65
+ muff: false
66
+ }
67
+ end
68
+
69
+ it "fetches a value by key indifferently from the given hash" do
70
+ expect(described_class.smart_fetch(hash, :foo)).to eq(hash[:foo])
71
+ expect(described_class.smart_fetch(hash, "foo")).to eq(hash[:foo])
72
+ expect(described_class.smart_fetch(hash, "muff")).to eq(hash[:muff])
73
+ end
74
+ end
75
+
61
76
  describe ".smart_store" do
62
77
  it "stores a value with the given key" do
63
78
  expect(described_class.smart_store({}, :key, "value")).to eq({key: "value"})
@@ -3,7 +3,7 @@ require "celsius/i18n"
3
3
  describe Celsius::I18n do
4
4
  let(:class_with_i18n_included) do
5
5
  Class.new.tap do |klass|
6
- klass.include(Celsius::I18n)
6
+ klass.send(:include, Celsius::I18n)
7
7
  end
8
8
  end
9
9
 
@@ -16,7 +16,7 @@ describe Celsius::I18n do
16
16
  let(:klass) do
17
17
  Class.new.tap do |_klass|
18
18
  _klass.class_variable_set(:@@locales, value_of_locales)
19
- _klass.include(Celsius::I18n)
19
+ _klass.send(:include, Celsius::I18n)
20
20
  end
21
21
  end
22
22
 
@@ -28,7 +28,7 @@ describe Celsius::I18n do
28
28
  context "when the including class has no class variable named @@locales" do
29
29
  let(:klass) do
30
30
  Class.new.tap do |_klass|
31
- _klass.include(Celsius::I18n)
31
+ _klass.send(:include, Celsius::I18n)
32
32
  end
33
33
  end
34
34
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celsius
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Sievers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-20 00:00:00.000000000 Z
11
+ date: 2015-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merger
@@ -142,7 +142,7 @@ rubyforge_project:
142
142
  rubygems_version: 2.4.5
143
143
  signing_key:
144
144
  specification_version: 4
145
- summary: celsius-0.4.1
145
+ summary: celsius-0.4.2
146
146
  test_files:
147
147
  - spec/assets/locales/de.yml
148
148
  - spec/assets/locales/en.yml