blobject 0.3.3 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blobject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-06 00:00:00.000000000 Z
12
+ date: 2012-06-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
16
- requirement: &70361576205220 !ruby/object:Gem::Requirement
16
+ requirement: &70166696947360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70361576205220
24
+ version_requirements: *70166696947360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest-reporters
27
- requirement: &70361576203480 !ruby/object:Gem::Requirement
27
+ requirement: &70166696945620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70361576203480
35
+ version_requirements: *70166696945620
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: pry
38
- requirement: &70361576201740 !ruby/object:Gem::Requirement
38
+ requirement: &70166696944240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70361576201740
46
+ version_requirements: *70166696944240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: debugger
49
- requirement: &70361576197280 !ruby/object:Gem::Requirement
49
+ requirement: &70166696941040 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70361576197280
57
+ version_requirements: *70166696941040
58
58
  description: Blobject provides a free flowing syntax for creating blobs of data.
59
59
  email:
60
60
  - sjltaylor@gmail.com
@@ -67,15 +67,29 @@ files:
67
67
  - Gemfile
68
68
  - Gemfile.lock
69
69
  - README.markdown
70
- - README.md_
71
70
  - Rakefile
71
+ - assets/blob_defn.png
72
+ - assets/blobject.png
72
73
  - benchmarks/benchmark.rb
73
74
  - benchmarks/results
74
- - blob_defn.png
75
75
  - blobject.gemspec
76
- - blobject.png
77
76
  - blobject.psd
78
77
  - console
78
+ - doc/Blobject.html
79
+ - doc/_index.html
80
+ - doc/class_list.html
81
+ - doc/css/common.css
82
+ - doc/css/full_list.css
83
+ - doc/css/style.css
84
+ - doc/file.README.html
85
+ - doc/file_list.html
86
+ - doc/frames.html
87
+ - doc/index.html
88
+ - doc/js/app.js
89
+ - doc/js/full_list.js
90
+ - doc/js/jquery.js
91
+ - doc/method_list.html
92
+ - doc/top-level-namespace.html
79
93
  - lib/blobject.rb
80
94
  - lib/blobject/version.rb
81
95
  - makefile
@@ -118,3 +132,4 @@ test_files:
118
132
  - spec/sample_data/sample.yaml
119
133
  - spec/sample_data/sample2.json
120
134
  - spec/sample_data/sample2.yaml
135
+ has_rdoc:
data/README.md_ DELETED
@@ -1,145 +0,0 @@
1
- ![](https://github.com/sjltaylor/blobject/raw/master/blobject.png)
2
-
3
-
4
- ## Usage
5
-
6
- This is how you could use blobject to present a model for a JSON api call
7
-
8
- def present(model)
9
- blobject do
10
- name.first model.first_name
11
- name.last model.last_name
12
- url 'http://www.youtube.com/watch?v=dQw4w9WgXcQ'
13
- end
14
- end
15
-
16
- If the were more calls in the 'name' namespace it might be more convenient to do
17
-
18
- def present(model)
19
- blobject do
20
- name do
21
- first model.first_name
22
- middle model.middle_name if model.has_middle_name?
23
- last model.last_name
24
- end
25
- url 'http://www.youtube.com/watch?v=dQw4w9WgXcQ'
26
- end
27
- end
28
-
29
- In each case, a blobject is returned that can be used like a normal object, or a hash
30
-
31
- b = present(model)
32
- b.name.first
33
- => 'Barry'
34
- b.name.has_middle?
35
- => true
36
- b[:url] # could also pass a string, blobject isn't a key fascist
37
- => "http://www.youtube.com/watch?v=dQw4w9WgXcQ"
38
-
39
- blobjects can be modified as follows
40
-
41
- b.modify do
42
- number 172367
43
- end
44
-
45
- They can be as complex/deep as required
46
-
47
- b = blobject do
48
- deep.nested.member.ofa.very.complex.thing 'HELLO WORLD'
49
- end
50
-
51
- b.deep.nested.member.ofa.very.complex.thing
52
- => 'HELLO WORLD'
53
-
54
-
55
-
56
-
57
- ## Creation options
58
-
59
- You can call blobject or Blobject.new with a hash to prefill it with data
60
-
61
- b = blobject :name => {:first => 'Barry'}
62
- b.name.first
63
- => 'Barry'
64
-
65
- b.modify { name.last 'McDoogle' }
66
- b.name.last
67
- => 'McDoogle'
68
-
69
- `blobject *params` is simply an alias for `Blobject.new *params`
70
-
71
- ## Checking for members
72
-
73
- to find out if a blobject already has a member:
74
-
75
- b = blobject
76
-
77
- b.has_name?
78
- => false
79
-
80
- b.modify do
81
- has_name?
82
- => false
83
- name 'Jim'
84
- has_name?
85
- => true
86
- end
87
-
88
- b.has_name?
89
- => true
90
-
91
- ## Usage Gists
92
-
93
- * [in the controller](https://gist.github.com/1254399)
94
-
95
- * [for configuration files](https://gist.github.com/1254403)
96
-
97
-
98
- ## Behaves like a hash
99
-
100
- * `#keys` returns all of the available keys
101
- * `#values` returns all of the available keys
102
- * `#each` enumerator of key, value pairs
103
- * `#[]` can be used for access to members, similarly `#[]=` can be used for assignment inside or outside of the modify block
104
- * `#dup` performs `Marshal.load(Marshal.dump(self))` for a deep copy
105
- * `#empty?` returns true if there are no members, false otherwise
106
- * `#to_yaml` and `#to_json`
107
-
108
- ## Load JSON and YAML from a file
109
-
110
- `blobject_file = Blobject.read('path/to/file.json')`
111
-
112
-
113
- Supported extensions: `yml`, `yaml`, `json`, `js`
114
-
115
-
116
- ## Limitations
117
-
118
- Blobjects are intended for de/serialization; cyclic object graphs will cause havoc
119
-
120
-
121
- ## Contributing to blobject
122
-
123
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
124
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
125
- * Fork the project
126
- * Start a feature/bugfix branch
127
- * Commit and push until you are happy with your contribution
128
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
129
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
130
-
131
- ## License
132
-
133
- (The MIT License)
134
-
135
- Copyright © 2011 [Sam Taylor](http://sjltaylor.com/)
136
-
137
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
138
-
139
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
140
-
141
- THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
142
-
143
- Copyright (c) 2011 Sam Taylor. See LICENSE.txt for
144
- further details.
145
-