self_data 1.2.0 → 1.2.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
  SHA256:
3
- metadata.gz: 0aea1610e7159d6d6ee44a4767f6906e007c436352debb0b852a59ce3550a889
4
- data.tar.gz: 67a2e1ba3dbaf1c39a0c0c6ba62013d6fb6ef23bf6c35b1fe49e8b78a3b9606d
3
+ metadata.gz: ace750c9fee999c5fee53ce98fa9e958f8cfa405234fc76433d0c12225167076
4
+ data.tar.gz: 1f37f78e87718c9ef7ce72c477803033e5a4d2c0d0eace08a89c416bdbfc1aed
5
5
  SHA512:
6
- metadata.gz: 7901656e8e7c1427e069e97f33e8a6262fd5a8a4e2ce49d0bb296cdde14965d9ccb6ceb30703632f01d2b4c3059a80b46070fa760698904c7da67488767238f1
7
- data.tar.gz: 8a9026eaf762ae36aa1247927e4f8dfbf1f2ca557582ebace53258a638473e4cd0b58a0b1f82166b25e140d9945bc956f0a322a3a44bd076e5c56ac7fa16cc6f
6
+ metadata.gz: 5c49d4345d6861651dc72f9a3389335baee5abebac90364830c68b05f5435ea81860873808e4d21055b929a4d0b9a3f441035ba76d94261640256054eb35935f
7
+ data.tar.gz: eaa40576e8998947d0799852c6adf5b474f702a3e1a77a05d466e7ec6de49efd7bbae83b646ef60158f1799e8cefc9085bd16b50bf5487c36e020b26ddf1d140
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --color
2
+ --format=progress
2
3
  --require spec_helper
@@ -1,24 +1,15 @@
1
1
  language: ruby
2
-
3
2
  sudo: false
4
-
5
- rvm:
6
- - 2.3
7
- - 2.4
8
- - 2.5
9
- - ruby-head
10
-
11
3
  before_install: gem install bundler
12
-
13
- env: SUITE="rspec"
14
-
15
- script: bundle exec $SUITE
16
-
4
+ script:
5
+ - bundle exec rubocop
6
+ - bundle exec rspec
17
7
  matrix:
18
8
  fast_finish: true
19
- # Only run RuboCop on the latest Ruby
20
9
  include:
21
- - rvm: 2.5
22
- env: SUITE="rubocop"
10
+ - rvm: 2.3.7
11
+ - rvm: 2.4.4
12
+ - rvm: 2.5.1
13
+ - rvm: ruby-head
23
14
  allow_failures:
24
15
  - rvm: ruby-head
data/README.md CHANGED
@@ -1,8 +1,26 @@
1
- # SelfData
1
+ # SelfData · [![Gem Version](https://badge.fury.io/rb/self_data.svg)](https://badge.fury.io/rb/self_data) [![Build Status](https://travis-ci.org/umbrellio/self_data.svg?branch=master)](https://travis-ci.org/umbrellio/self_data) [![Coverage Status](https://coveralls.io/repos/github/umbrellio/self_data/badge.svg)](https://coveralls.io/github/umbrellio/self_data)
2
2
 
3
3
  It's like native ruby `DATA` but you can use it not only for main file.
4
4
 
5
- For example:
5
+ ## Installation
6
+
7
+ ```ruby
8
+ # Gemfile
9
+ gem 'self_data'
10
+ ```
11
+
12
+ ```shell
13
+ $ bundle install
14
+ -- or --
15
+ $ gem install self_data
16
+ ```
17
+
18
+ ```ruby
19
+ require 'self_data'
20
+ ```
21
+
22
+ ## Synopsis
23
+
6
24
  ```ruby
7
25
  # main.rb
8
26
 
@@ -36,16 +54,33 @@ a.rb data
36
54
  ```
37
55
 
38
56
  and if you execute it, you'll get:
39
- ```
57
+
58
+ ```shell
40
59
  $ ruby main.rb
41
60
  DATA: main.rb data
42
61
  SelfData: a.rb data
43
62
  ```
44
63
 
45
- # Usage
64
+ ## Usage and Notes
65
+
46
66
  Use `SelfData.read()` to get text or use `SelfData.load(*formats, **options)` to get formatted data (like yaml, xml, erb, etc).
47
67
 
48
68
  Look at the [lib/self_data/config.rb](https://github.com/umbrellio/self_data/blob/master/lib/self_data/config.rb) for more details.
49
69
 
50
- # Note
51
70
  SelfData uses `caller`, it's not fast, that's why you shouldn't use SelfData in loops.
71
+
72
+ ## Contributing
73
+
74
+ Bug reports and pull requests are welcome on GitHub at https://github.com/umbrellio/self_data.
75
+
76
+ ## License
77
+
78
+ Released under MIT License.
79
+
80
+ ## Authors
81
+
82
+ Created by [7dr1v3](https://github.com/7dr1v3)
83
+
84
+ <a href="https://github.com/umbrellio/">
85
+ <img style="float: left;" src="https://umbrellio.github.io/Umbrellio/supported_by_umbrellio.svg" alt="Supported by Umbrellio" width="439" height="72">
86
+ </a>
@@ -2,13 +2,5 @@
2
2
 
3
3
  require "bundler/setup"
4
4
  require "self_data"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
5
+ require "pry"
6
+ Pry.start
@@ -1,18 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "yaml"
4
- require "json"
5
-
6
3
  class SelfData
7
4
  class << self
8
5
  attr_accessor :default_formats, :default_options
9
6
 
10
- def read(*args)
11
- new.read(*args)
7
+ def read(*args, **kargs)
8
+ new.read(*args, **kargs)
12
9
  end
13
10
 
14
- def load(*args)
15
- new.load(*args)
11
+ def load(*args, **kargs)
12
+ new.load(*args, **kargs)
16
13
  end
17
14
 
18
15
  def filters
@@ -46,8 +43,8 @@ class SelfData
46
43
  raise ConverterNotFound, format unless self.class.converters[format]
47
44
  begin
48
45
  self.class.converters[format].call(data, options)
49
- rescue => e
50
- raise ConversionError.new(format, e)
46
+ rescue => error
47
+ raise ConversionError.new(format, error)
51
48
  end
52
49
  end
53
50
  end
@@ -1,5 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "erb"
4
+ require "yaml"
5
+ require "json"
6
+
3
7
  SelfData.default_formats = [:erb, :yaml]
4
8
  SelfData.default_options = {}
5
9
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SelfData
4
- VERSION = "1.2.0"
4
+ VERSION = "1.2.1"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path("../lib", __FILE__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require "self_data/version"
6
6
 
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.authors = ["Umbrellio"]
13
13
  spec.email = ["info@umbrellio.biz"]
14
14
 
15
- spec.summary = ""
15
+ spec.summary = "It's like DATA but better"
16
16
  spec.description = "It's like DATA but better"
17
17
  spec.homepage = "https://github.com/umbrellio/self_data"
18
18
  spec.license = "MIT"
@@ -23,8 +23,10 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  spec.add_development_dependency "bundler"
26
+ spec.add_development_dependency "coveralls"
26
27
  spec.add_development_dependency "pry"
27
28
  spec.add_development_dependency "rake"
28
29
  spec.add_development_dependency "rspec"
29
30
  spec.add_development_dependency "rubocop-config-umbrellio"
31
+ spec.add_development_dependency "simplecov"
30
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: self_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Umbrellio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-05 00:00:00.000000000 Z
11
+ date: 2020-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: coveralls
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: pry
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +94,20 @@ dependencies:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  description: It's like DATA but better
84
112
  email:
85
113
  - info@umbrellio.biz
@@ -123,9 +151,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
151
  - !ruby/object:Gem::Version
124
152
  version: '0'
125
153
  requirements: []
126
- rubyforge_project:
127
- rubygems_version: 2.7.6
154
+ rubygems_version: 3.1.2
128
155
  signing_key:
129
156
  specification_version: 4
130
- summary: ''
157
+ summary: It's like DATA but better
131
158
  test_files: []