self_data 0.1.1 → 1.0.0

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: 28e3d2e929cb6dc71853674d8e788fdf866718d2
4
- data.tar.gz: b4ac4584361cdeb25b5f7c5c180dbb08b50c9cdf
3
+ metadata.gz: c8962303f898d24eda050395bd35c083e49398da
4
+ data.tar.gz: a374856a6e86a6b75f41d94d98fe22a665b2f912
5
5
  SHA512:
6
- metadata.gz: 7313202912a4ae66d7289740dcf857da282d9560285a91f8bde254c5d0274cb84634f847642d855f1b4cc6e33116f4d0e741d1d1899e3b1063a379a12902e875
7
- data.tar.gz: 729dd182ad83b6763e5f3773f02ced2d4174605f217ca693b231d05be83ffc7189a7d7b146ac60f85e6579c52049c7a792b3572ea39b3e5ddbdb462be4704f3f
6
+ metadata.gz: 401be953df4e180a387f1e2c35cbe4b7a706ddfde483ec91ec56a9dcb1b8d43625ff3547dffcdee396318c6fe4fd33c7adbbeeec3392d9ff7e1a21c1ae61eedc
7
+ data.tar.gz: eb071a1c1c2f3b5fe5f5039a3fc694cbf09326dd5fe3223e1acb2fe80e4556a3cb6b43db8e2d9a305da819fbb9a3c0eaedc14fb6fdc41f8a04ed5189c9ec8a9a
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 7dr1v3
1
+ Copyright (c) 2017 Umbrellio
2
2
 
3
3
 
4
4
 
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")
@@ -4,3 +4,4 @@ SelfData.filters = []
4
4
 
5
5
  SelfData.add_converter :erb, ->(data, options) { ERB.new(data).result(options[:context]) }
6
6
  SelfData.add_converter :yaml, ->(data, _options) { YAML.load(data) }
7
+ SelfData.add_converter :json, ->(data, _options) { JSON.parse(data) }
@@ -1,3 +1,3 @@
1
1
  class SelfData
2
- VERSION = "0.1.1"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/self_data.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "yaml"
2
+ require "json"
2
3
  require "active_support/core_ext/module/delegation.rb"
3
4
  require "active_support/core_ext/class/attribute.rb"
4
5
 
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 = ["TDrive"]
10
- spec.email = ["tdrive@xc0de.ru"]
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/7dr1v3/self_data"
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.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - TDrive
7
+ - Umbrellio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-07 00:00:00.000000000 Z
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
- - tdrive@xc0de.ru
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/7dr1v3/self_data
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.4.5.1
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: