self_data 0.1.1 → 1.0.0
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/LICENSE.txt +1 -1
- data/README.md +50 -0
- data/bin/rspec +17 -0
- data/lib/self_data/config.rb +1 -0
- data/lib/self_data/version.rb +1 -1
- data/lib/self_data.rb +1 -0
- data/self_data.gemspec +3 -3
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8962303f898d24eda050395bd35c083e49398da
|
4
|
+
data.tar.gz: a374856a6e86a6b75f41d94d98fe22a665b2f912
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 401be953df4e180a387f1e2c35cbe4b7a706ddfde483ec91ec56a9dcb1b8d43625ff3547dffcdee396318c6fe4fd33c7adbbeeec3392d9ff7e1a21c1ae61eedc
|
7
|
+
data.tar.gz: eb071a1c1c2f3b5fe5f5039a3fc694cbf09326dd5fe3223e1acb2fe80e4556a3cb6b43db8e2d9a305da819fbb9a3c0eaedc14fb6fdc41f8a04ed5189c9ec8a9a
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1 +1,51 @@
|
|
1
1
|
# SelfData
|
2
|
+
|
3
|
+
It's like native ruby DATA but you can use it not only for main file.
|
4
|
+
|
5
|
+
For example:
|
6
|
+
```ruby
|
7
|
+
# main.rb
|
8
|
+
|
9
|
+
require 'self_data'
|
10
|
+
require './a.rb'
|
11
|
+
|
12
|
+
puts "DATA: #{A.native_data}"
|
13
|
+
puts "SelfData: #{A.self_data}"
|
14
|
+
|
15
|
+
__END__
|
16
|
+
main.rb data
|
17
|
+
```
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
# a.rb
|
21
|
+
|
22
|
+
module A
|
23
|
+
module_function
|
24
|
+
|
25
|
+
def native_data
|
26
|
+
DATA.read
|
27
|
+
end
|
28
|
+
|
29
|
+
def self_data
|
30
|
+
SelfData.read
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
__END__
|
35
|
+
a.rb data
|
36
|
+
```
|
37
|
+
|
38
|
+
and if you execute it, you'll get:
|
39
|
+
```
|
40
|
+
$ ruby main.rb
|
41
|
+
DATA: main.rb data
|
42
|
+
SelfData: a.rb data
|
43
|
+
```
|
44
|
+
|
45
|
+
# Usage
|
46
|
+
Use `SelfData.read()` to get text or use `SelfData.load(*formats, **options)` to get formatted data (like yaml, xml, erb, etc).
|
47
|
+
|
48
|
+
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
|
+
|
50
|
+
# Note
|
51
|
+
SelfData use caller, it's not fast, that is why you shouldn't use SelfData in loops.
|
data/bin/rspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rspec' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/lib/self_data/config.rb
CHANGED
data/lib/self_data/version.rb
CHANGED
data/lib/self_data.rb
CHANGED
data/self_data.gemspec
CHANGED
@@ -6,12 +6,12 @@ require 'self_data/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "self_data"
|
8
8
|
spec.version = SelfData::VERSION
|
9
|
-
spec.authors = ["
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["Umbrellio"]
|
10
|
+
spec.email = ["info@umbrellio.biz"]
|
11
11
|
|
12
12
|
spec.summary = ""
|
13
13
|
spec.description = "It's like DATA but better"
|
14
|
-
spec.homepage = "https://github.com/
|
14
|
+
spec.homepage = "https://github.com/umbrellio/self_data"
|
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)/}) }
|
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: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Umbrellio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
version: '0'
|
97
97
|
description: It's like DATA but better
|
98
98
|
email:
|
99
|
-
-
|
99
|
+
- info@umbrellio.biz
|
100
100
|
executables: []
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
@@ -110,13 +110,14 @@ files:
|
|
110
110
|
- README.md
|
111
111
|
- Rakefile
|
112
112
|
- bin/console
|
113
|
+
- bin/rspec
|
113
114
|
- bin/setup
|
114
115
|
- lib/self_data.rb
|
115
116
|
- lib/self_data/config.rb
|
116
117
|
- lib/self_data/errors.rb
|
117
118
|
- lib/self_data/version.rb
|
118
119
|
- self_data.gemspec
|
119
|
-
homepage: https://github.com/
|
120
|
+
homepage: https://github.com/umbrellio/self_data
|
120
121
|
licenses:
|
121
122
|
- MIT
|
122
123
|
metadata: {}
|
@@ -136,8 +137,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
137
|
version: '0'
|
137
138
|
requirements: []
|
138
139
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.
|
140
|
+
rubygems_version: 2.5.1
|
140
141
|
signing_key:
|
141
142
|
specification_version: 4
|
142
143
|
summary: ''
|
143
144
|
test_files: []
|
145
|
+
has_rdoc:
|