celsius 0.4.0 → 0.4.1

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: 347a4f4d7898e806d74c07e71f0c0f303ac52d5f
4
- data.tar.gz: 0757d90d257529ef4005b5edea762707e5b09d1c
3
+ metadata.gz: 6c5d32b578f85a2e0fc6375d76348d545ec103fb
4
+ data.tar.gz: 8808342fa762eda0cf8dba9eea427945fd8a0255
5
5
  SHA512:
6
- metadata.gz: 6d119c40a39c4cd69bf00e8bb286580e623adf72fd40185612282d00fd1d9f7aad1335bd11a3ea1a4d77a199627625b2df072c252fd47a99bdfe6c253a2e79f7
7
- data.tar.gz: 15dd8d70fdf9bfb6c2953a373ad6c5908426ae520135a66821c4c2f4496ec023156102e59c8e459f665144d587805af000dbba5c4973825194ca04cfa4281fc7
6
+ metadata.gz: 4910cc3d48e6ad488cebedaf7cf9a4b5c9b57c12ada486d62b4ced776643fad6cdafab6018b464d5b06e01808130d2bfe91f6d264e6b45cfaaa7e4f3c6d189db
7
+ data.tar.gz: 74827774d03aa7a2bbe810cf6735fd37f2e67da69531a035245c3f93980951ad911f4fa2adeb7115aa28254c05d5e96bf6f2d9c024fb678f45a26489d73ced0e
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - "2.2.0"
4
+ addons:
5
+ code_climate:
6
+ repo_token: 61fdb22b9d91351ec7ab58dc8b544cd4858fe63b34fc2174165432f0559fecac
data/Gemfile CHANGED
@@ -3,6 +3,8 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in celsius.gemspec
4
4
  gemspec
5
5
 
6
+ gem "codeclimate-test-reporter", group: :test, require: nil
7
+
6
8
  gem "pry", "~> 0.9.12.6"
7
9
  gem "pry-nav", "~> 0.2.3"
8
10
  gem "pry-stack_explorer", "~> 0.4.9.1"
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Celsius [![Code Climate](https://codeclimate.com/github/ubpb/celsius/badges/gpa.svg)](https://codeclimate.com/github/ubpb/celsius)
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)
2
2
 
3
3
  TODO: Write a gem description
4
4
 
data/lib/celsius/hash.rb CHANGED
@@ -31,4 +31,18 @@ module Celsius::Hash
31
31
  results.empty? ? nil : results
32
32
  end
33
33
  end
34
+
35
+ def self.smart_store(hash, key, value)
36
+ if hash[key]
37
+ unless hash[key].is_a?(Array)
38
+ hash[key] = [hash[key]]
39
+ end
40
+
41
+ hash[key].push(value)
42
+ else
43
+ hash[key] = value
44
+ end
45
+
46
+ hash
47
+ end
34
48
  end
@@ -1,3 +1,3 @@
1
1
  module Celsius
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -57,4 +57,16 @@ describe Celsius::Hash do
57
57
  end
58
58
  end
59
59
  end
60
+
61
+ describe ".smart_store" do
62
+ it "stores a value with the given key" do
63
+ expect(described_class.smart_store({}, :key, "value")).to eq({key: "value"})
64
+ end
65
+
66
+ context "if the key allready exists" do
67
+ it "converts the value to an array and pushes the value to it" do
68
+ expect(described_class.smart_store({key: "foo"}, :key, "bar")).to eq({key: ["foo", "bar"]})
69
+ end
70
+ end
71
+ end
60
72
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,10 @@
1
- require "simplecov"
2
- SimpleCov.start
1
+ if ENV["TRAVIS"]
2
+ require "codeclimate-test-reporter"
3
+ CodeClimate::TestReporter.start
4
+ else
5
+ require "simplecov"
6
+ SimpleCov.start
7
+ end
3
8
 
4
9
  require "celsius"
5
10
  begin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celsius
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Sievers
@@ -94,6 +94,7 @@ extra_rdoc_files: []
94
94
  files:
95
95
  - ".gitignore"
96
96
  - ".rspec"
97
+ - ".travis.yml"
97
98
  - Gemfile
98
99
  - LICENSE.txt
99
100
  - README.md
@@ -141,7 +142,7 @@ rubyforge_project:
141
142
  rubygems_version: 2.4.5
142
143
  signing_key:
143
144
  specification_version: 4
144
- summary: celsius-0.4.0
145
+ summary: celsius-0.4.1
145
146
  test_files:
146
147
  - spec/assets/locales/de.yml
147
148
  - spec/assets/locales/en.yml