yew 0.0.3 → 0.0.4

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 +8 -8
  2. data/README.md +93 -9
  3. metadata +5 -4
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2Q2Y2RiZDkxMjg2YTJlNzZhZjJlMzBmMTc0M2NlMTkxODkxZGRlZg==
4
+ YmM3YzFiOTNmYTAxYzFjODViNTIzOWJmYjlmMjUwOTJmMDNhYWE0Mg==
5
5
  data.tar.gz: !binary |-
6
- YjMzMWI5MWU0NzAzODYyZmY1ZWZjNDhmZTg3YTAzYjc3Mzk4Y2RmYQ==
6
+ YTE0MWJlNjQzMTNhYjU2NjE2ZmFiMzEzM2M5Zjc5Zjc3MDM2MzI2Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODA1NWRmZmJiMmYzZTJhNWQzNWUyMzgzOTA1YTQ3MmUzYWI5MGM1MWJkMDU3
10
- NjljZDQzZjlkMmNlZjgwYzUyZDQ2ZWYyNzVkNjFhN2UxM2MwMTQ5NzI3MTdi
11
- NTExYzYxODFiNjY1Yjk1Mjc4MTgwM2NlZDdlZDJlN2I0MGViMjA=
9
+ MGI5OWFjZGQyZWU5ZTcwM2M0ZTBhNzViMDk2ODZiOTNjNzIzNDAzNTg0YTMw
10
+ NzBhN2I2ODE0MjVkZjNmMjFlZmU1Y2M5MGQ0MmRhZjYwMzdjNjQ3YjRkMTg5
11
+ OGM1OGEwY2E2MzZhNjM2NjhlOTRhZjcyNGJmNTRmMTM4NWVjODc=
12
12
  data.tar.gz: !binary |-
13
- OThhNjNhMzZhNjNkNDFkZGIzZTliNTgwZTAzMDQ3MWJiYjBkOWJjYjcxOTRi
14
- OTliMWYzZWRkNjUzOGI2NWI1OWE5YjhmMTg5MTIzMWQ2NDg3MmNlODZmNmJl
15
- YzM2NzIxMzQwOTEzOWNmOTE0ZjM4NzU4Zjk4YmY1MGQzODA2ODg=
13
+ NTBmZGY1NTY2YzU0ZjRiMTI3OGZkMzBkNjU2NWY4MTFkOGZhNzgyNmI3NTgx
14
+ N2RjMmQzYjJmNjNhZWE3YjZlMGJmMDMwNTk0ZDAyOTAyZTcxOTI1MjVkNDc4
15
+ Y2EzNjQ2MTIwMmY3MzQ4YjVlZTNiMzg5NTBhYmRhYjc2YWMzN2I=
data/README.md CHANGED
@@ -1,9 +1,93 @@
1
- $YEW_DEBUG = true
2
- require 'yew'
3
-
4
- Env = Yew.load('config/env.yml')
5
- Env[]
6
- Env.orientdb[]
7
- Env.orientdb.url
8
- Env['orientdb']
9
- Env['orientdb'].url
1
+ # Yew
2
+
3
+ Yew allows traversing a Hash structure as if it is an object tree.
4
+
5
+
6
+ ## Usage
7
+
8
+ Given the following yml file located at `config/env.yml`:
9
+
10
+ ``` yaml
11
+ orientdb:
12
+ url: 'remote:localhost/db'
13
+ user: admin
14
+ pass: secret
15
+
16
+ testing:
17
+ frameworks:
18
+ rspec: true
19
+ minitest: false
20
+ ```
21
+
22
+
23
+ - Load the YAML structure.
24
+
25
+ ``` ruby
26
+ Env = Yew.load('config/env.yml')
27
+ ```
28
+
29
+
30
+ - Traverse the structure contents.
31
+
32
+ ``` ruby
33
+ Env.orientdb.user
34
+ # => 'admin'
35
+ ```
36
+
37
+ - Obtain the underlying Hash.
38
+
39
+ ``` ruby
40
+ Env.testing.frameworks[]
41
+ # => {"rspec"=>true, "minitest"=>false}
42
+ ```
43
+
44
+
45
+ - A tree can also be traversed like a normal Hash.
46
+
47
+ ``` ruby
48
+ Env['orientdb']['user']
49
+ # => 'admin'
50
+
51
+ Env['orientdb'].user
52
+ # => 'admin'
53
+ ```
54
+
55
+
56
+ - It raises well formed errors when accessing inexistent paths.
57
+
58
+ ``` ruby
59
+ Env['orientdb'].timeout
60
+ # => RuntimeError: Attribute timeout not found at /orientdb
61
+ ```
62
+
63
+
64
+ - Set `$YEW_DEBUG` when need to inspect `Yew::Tree` objects under irb.
65
+
66
+
67
+ ``` ruby
68
+ irb> $YEW_DEBUG = true
69
+ irb> require 'yew'
70
+ ```
71
+
72
+ ## Installation
73
+
74
+ There are two options for installation: packaged gem and source file.
75
+
76
+ 1. Install Yew as a gem.
77
+
78
+ ``` shell
79
+ gem install yew
80
+ ```
81
+
82
+
83
+ 2. Download raw lib into a project source tree.
84
+
85
+ ``` shell
86
+ curl "https://raw.github.com/snmgian/yew/master/lib/yew.rb" 2>/dev/null -o "yew.rb"
87
+ ```
88
+
89
+ ## License
90
+
91
+ This software is licensed under the [LGPL][lgpl] license.
92
+
93
+ [lgpl]: https://www.gnu.org/licenses/lgpl.html
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yew
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gianfranco Zas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-02 00:00:00.000000000 Z
11
+ date: 2013-10-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Reads from .yml files and provides an object for key traversing.
14
14
  email: snmgian@gmail.com
@@ -20,8 +20,9 @@ files:
20
20
  - COPYING
21
21
  - COPYING.LESSER
22
22
  - README.md
23
- homepage: http://rubygems.org/gems/yew
24
- licenses: []
23
+ homepage: https://github.com/snmgian/yew
24
+ licenses:
25
+ - LGPL
25
26
  metadata: {}
26
27
  post_install_message:
27
28
  rdoc_options: []