rest_dsl 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 065d9784032984b8e45ec01e90b36b210c43fa389c480ac1374a5c9eae0ec46d
4
- data.tar.gz: 2abc894bf2552ac5f4f24776c41aa3fc00368d2b15f23f17714d440a3dba92ab
3
+ metadata.gz: 44c4e15596a19b17765538e7c867c8541e499937414adce0e8d9a3877c8bf070
4
+ data.tar.gz: 6d4c7c10d868dd18cf7c62641762f466dc92a1749878c831bfb5c4cec09db222
5
5
  SHA512:
6
- metadata.gz: 8dea12da4cedebbb131c12940b00749f0bbaeae85a333de4fe3cf09687e2019faf5f3a1d57dbbdc1440577e62392d02d1cacc66df0ab766c1661030ce9e34d56
7
- data.tar.gz: 327df61aabf9f0a680243cb0870a9df97f2be3b25d4b64a3ede13308c13f2e2a465818f63157c3b53f3c4e92f9c6f802bfcf157feb5264131cae313d82fe6e6a
6
+ metadata.gz: cc625f1de6e41dd9349bd5ad7e4014b034ea530bbd709b588f14b8530862477f6c79d08e0675ea7da9fff58c07f0d485adfd842f4b701d485404208b65abcb3e
7
+ data.tar.gz: d3baa1afa50243b953b78716d23339602ab8767eb78e2ae4e5c153b79ef6e6db625021f5d38b7e8a71a884713be308f493bd9f6fd9eea5e791a1aef2a185ebfc
data/lib/rest_dsl/dsl.rb CHANGED
@@ -13,30 +13,19 @@ module RestDSL
13
13
  module DSLExtensions
14
14
 
15
15
  ##
16
- # Adds a DSL method for parsing information from a file, parser list can be overridden by setting
17
- # @file_parsers. If no parser is designed, for the file extension, loads the file as plain text
16
+ # Adds a DSL method for parsing information from a file, parser list can be overridden by redefining file_parsers
17
+ # If no parser is designed, for the file extension, loads the file as plain text
18
18
  module FromFile
19
19
 
20
- def self.extended(clazz)
21
- clazz.instance_eval do
22
- @file_parsers = {
23
- %w[.json] => JSON,
24
- %w[.yml .yaml] => Psych
25
- }
26
- end
27
- end
28
-
29
- def self.included(clazz)
30
- clazz.instance_eval do
31
- @file_parsers = {
32
- %w[.json] => JSON,
33
- %w[.yml .yaml] => Psych
34
- }
35
- end
20
+ def file_parsers
21
+ {
22
+ %w[.json] => JSON,
23
+ %w[.yml .yaml] => Psych
24
+ }
36
25
  end
37
26
 
38
27
  def from_file(file_name)
39
- parser = @file_parsers.find{|key, _| key.any? {|file_type| file_name.include? file_type}}[1]
28
+ parser = file_parsers.find{|key, _| key.any? {|file_type| file_name.include? file_type}}[1]
40
29
  result = if parser.eql?(Psych)
41
30
  parser.load_file(file_name)
42
31
  else # Most non-yaml parsers in ruby work like the json one so lets make it be the default.
@@ -1,3 +1,3 @@
1
1
  module RestDSL
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Ridge