datagnan 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/datagnan.rb +14 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb67371aa0b5e42c13faf09b9b89192bd758af17
4
- data.tar.gz: 2f96688ca5ccb0b35f8ac2839431dab3b9b4bc30
3
+ metadata.gz: 6ab6c13f241c6ea685e9a2e7ad01972240bf7952
4
+ data.tar.gz: 50b65b4dc8ca57571b64936be1508859a80c3fce
5
5
  SHA512:
6
- metadata.gz: a3805ac064b852bf470362406452b58deb4eefd1f1684d77c6bb6d4127beea75f1a24c30bf755ebbb6e1e745abda42c1983a76e6c47705b3a81010e7ac2afc77
7
- data.tar.gz: 1bc54f6aab35831a7f21efe81ad1ba867900889e71742bca7c5af11610d6d5d29ef30e80aade05920ab5e52bed37a1ef2cff3fbf48cf216322775c00e856f6fa
6
+ metadata.gz: 9d8ca7ab6a3d5b44f2905c95be8dc7d56f59e6aec3841af958b938987032d9af85ef8b57492ba7d7a545f65014ef2fb39286c60a48df850397f8c3d33f436d34
7
+ data.tar.gz: 82295ca0a84925b8b8a248606cf08ad3860ef3ebe57f6cab6b906d8fc406066296fbbfafd654007d74dde1400b689906a26fa4b29752caa6181518a65da91cd5
@@ -110,6 +110,14 @@ class Datagnan
110
110
 
111
111
  private
112
112
 
113
+ ## check class exists
114
+ def class_exists?(class_name)
115
+ klass = Module.const_get(class_name)
116
+ return klass.is_a?(Class)
117
+ rescue NameError
118
+ return false
119
+ end
120
+
113
121
  ## find value in vars and scope
114
122
  def find_value(path, vars)
115
123
  ## recursive access to property
@@ -122,11 +130,16 @@ private
122
130
  # puts "-- Datagnan.find_value split ( key = #{key} )"
123
131
  # puts "-- Datagnan.find_value split ( @scope.respond_to?(key) = #{@scope.respond_to?(key)} )"
124
132
  # puts "-- Datagnan.find_value split ( @scope.send(key) = #{@scope.send(key)} )" if @scope.respond_to?(key)
133
+ # puts "-- Datagnan.find_value split ( class_exists?(key) = #{class_exists?(key)} )"
134
+ # puts "-- Datagnan.find_value split ( Module.const_get(key) = #{Module.const_get(key)} )" if class_exists?(key)
125
135
  var = ( var.is_a?(Hash) ?
126
136
  ( var[key].nil? ?
127
137
  ( @scope.respond_to?(key) ?
128
138
  @scope.send(key) :
129
- nil
139
+ ( class_exists?(key) ?
140
+ Module.const_get(key) :
141
+ nil
142
+ )
130
143
  ) :
131
144
  var[key]
132
145
  ) :
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datagnan
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Popov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-29 00:00:00.000000000 Z
12
+ date: 2015-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oga