bogy 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -0
- data/CHANGELOG.md +9 -0
- data/LICENSE +19 -0
- data/README.md +11 -22
- data/Rakefile +10 -8
- data/bogy.gemspec +5 -4
- data/lib/bogy.rb +12 -9
- data/lib/bogy/file_handler.rb +1 -1
- data/lib/bogy/handler.rb +0 -1
- data/lib/bogy/version.rb +2 -2
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a0162ab0c2ec49013649bcf9f947f8cdab60239
|
4
|
+
data.tar.gz: 705d10c8dbf556703c0bb39afff10f468e2dfeb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8add9e85a503fcd88eb7e3f35d7ffe2fae46308cbecf5aa9c302e5ec596a7567a4c3eb812a724d01ec12da77d0b398c6eb5553dd52702c19fbdec2ae3e97cbd
|
7
|
+
data.tar.gz: fc6dce56de9a052b56074e38acec775da200a529ed7baf2167ecac4daa46f31a9dd355b5faab5ce95455f854c899c509fde8933085de8a9da2970c0732ab111e
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2015 Albert Nigmatzianov
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,26 +1,15 @@
|
|
1
|
-
|
1
|
+
*bogy* is Ruby wrapper for YAML, which provides a little more convenient interaction with YAML
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/bogy.svg)](http://badge.fury.io/rb/bogy)
|
4
|
+
[![Build Status](https://travis-ci.org/bogem/bogy.svg?branch=master)](https://travis-ci.org/bogem/bogy)
|
5
|
+
[![Dependency Status](https://gemnasium.com/bogem/bogy.svg)](https://gemnasium.com/bogem/bogy)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/bogem/bogy/badges/gpa.svg)](https://codeclimate.com/github/bogem/bogy)
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'bogy'
|
11
|
-
```
|
12
|
-
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
10
|
$ gem install bogy
|
20
11
|
|
21
|
-
##
|
22
|
-
|
23
|
-
### Available methods
|
12
|
+
## Available methods
|
24
13
|
```ruby
|
25
14
|
# Parsing files
|
26
15
|
path = 'file.yml'
|
@@ -30,9 +19,9 @@ yaml = Bogy.new(file: path)
|
|
30
19
|
string = "---\n:a: 1\n:b: 2\n" # Looks {a: 1, b: 2} as hash
|
31
20
|
yaml = Bogy.new(string: string)
|
32
21
|
|
33
|
-
yaml[
|
34
|
-
yaml[
|
35
|
-
yaml.delete(
|
22
|
+
yaml['foo'] = 'bar' # => "bar". Automatically writes to file, if you parse file
|
23
|
+
yaml['foo'] # => "bar"
|
24
|
+
yaml.delete('foo') # => "bar". Also automatically writes to file, if you parse file
|
36
25
|
yaml.to_h # => {:a=>1, :b=>2}
|
37
26
|
yaml.to_yaml # => ---\n:a: 1\n:b: 2\n"
|
38
27
|
yaml.write_to_file('another_yaml_file.yml') # Writes to 'another_yaml_file.yml' file
|
@@ -42,6 +31,6 @@ hash = {a: 1, b:2}
|
|
42
31
|
Bogy.new(hash: hash).write_to_file('file.yml') # Automatically converts to YAML
|
43
32
|
```
|
44
33
|
|
45
|
-
##
|
34
|
+
## License
|
46
35
|
|
47
|
-
|
36
|
+
MIT License
|
data/Rakefile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'bundler'
|
4
|
+
Bundler::GemHelper.install_tasks
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
t.libs << "lib"
|
7
|
-
t.test_files = FileList['test/**/*_test.rb']
|
8
|
-
end
|
6
|
+
desc 'Run all tests by default'
|
7
|
+
task default: :spec
|
9
8
|
|
10
|
-
|
9
|
+
require 'rspec/core/rake_task'
|
10
|
+
RSpec::Core::RakeTask.new do |t|
|
11
|
+
t.rspec_opts = ['--color', '--format doc']
|
12
|
+
end
|
data/bogy.gemspec
CHANGED
@@ -6,17 +6,18 @@ require 'bogy/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'bogy'
|
8
8
|
spec.version = Bogy::VERSION
|
9
|
-
spec.authors = ['Albert']
|
9
|
+
spec.authors = ['Albert Nigmatzianov']
|
10
10
|
spec.email = ['albertnigma@gmail.com']
|
11
11
|
|
12
|
-
spec.summary = %q{
|
13
|
-
spec.description = %q{bogy is
|
12
|
+
spec.summary = %q{Ruby wrapper for YAML}
|
13
|
+
spec.description = %q{bogy is Ruby wrapper for YAML, which provides a little more convenient interaction with YAML}
|
14
14
|
spec.homepage = 'https://github.com/bogem/bogy'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.require_paths = [
|
18
|
+
spec.require_paths = ['lib']
|
19
19
|
|
20
20
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
21
21
|
spec.add_development_dependency 'rake', '~> 10.0'
|
22
|
+
spec.add_development_dependency 'rspec', '~> 3.3.0'
|
22
23
|
end
|
data/lib/bogy.rb
CHANGED
@@ -7,17 +7,20 @@ require 'bogy/hash_handler'
|
|
7
7
|
require 'bogy/string_handler'
|
8
8
|
|
9
9
|
class Bogy
|
10
|
-
def initialize(
|
11
|
-
# If user provides
|
12
|
-
fail ArgumentError
|
10
|
+
def initialize(options = nil)
|
11
|
+
# If user provides no arguments
|
12
|
+
fail ArgumentError, 'wrong number of arguments (0 for 1)' if options.nil?
|
13
|
+
|
14
|
+
# If user provides more than one arguments
|
15
|
+
fail ArgumentError, 'you should provide only one argument' if options.length > 1
|
13
16
|
|
14
17
|
@handler =
|
15
|
-
if file
|
16
|
-
FileHandler.new(file)
|
17
|
-
elsif hash
|
18
|
-
HashHandler.new(hash)
|
19
|
-
elsif string
|
20
|
-
StringHandler.new(string)
|
18
|
+
if options[:file]
|
19
|
+
FileHandler.new(options[:file])
|
20
|
+
elsif options[:hash]
|
21
|
+
HashHandler.new(options[:hash])
|
22
|
+
elsif options[:string]
|
23
|
+
StringHandler.new(options[:string])
|
21
24
|
end
|
22
25
|
end
|
23
26
|
|
data/lib/bogy/file_handler.rb
CHANGED
data/lib/bogy/handler.rb
CHANGED
data/lib/bogy/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = '1.
|
1
|
+
class Bogy
|
2
|
+
VERSION = '1.1'.freeze
|
3
3
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bogy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Albert
|
7
|
+
- Albert Nigmatzianov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,8 +38,22 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
|
42
|
-
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.3.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.3.0
|
55
|
+
description: bogy is Ruby wrapper for YAML, which provides a little more convenient
|
56
|
+
interaction with YAML
|
43
57
|
email:
|
44
58
|
- albertnigma@gmail.com
|
45
59
|
executables: []
|
@@ -48,7 +62,9 @@ extra_rdoc_files: []
|
|
48
62
|
files:
|
49
63
|
- ".gitignore"
|
50
64
|
- ".travis.yml"
|
65
|
+
- CHANGELOG.md
|
51
66
|
- Gemfile
|
67
|
+
- LICENSE
|
52
68
|
- README.md
|
53
69
|
- Rakefile
|
54
70
|
- bogy.gemspec
|
@@ -82,5 +98,5 @@ rubyforge_project:
|
|
82
98
|
rubygems_version: 2.4.8
|
83
99
|
signing_key:
|
84
100
|
specification_version: 4
|
85
|
-
summary:
|
101
|
+
summary: Ruby wrapper for YAML
|
86
102
|
test_files: []
|