ribbon 0.0.1 → 0.0.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.
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  *.lock
2
+ doc/
@@ -1,2 +1,8 @@
1
+ # Ruby Object Notation.
2
+ #
3
+ # Inspired by JSON and OpenStruct.
4
+ module Ribbon
5
+ end
6
+
1
7
  require 'ribbon/object'
2
8
  require 'ribbon/version'
@@ -0,0 +1,8 @@
1
+ require 'ribbon/core_ext/hash'
2
+
3
+ module Ribbon
4
+
5
+ # Optional extensions to the standard library to make life easier.
6
+ module CoreExt; end
7
+
8
+ end
@@ -0,0 +1,22 @@
1
+ require 'ribbon/object'
2
+
3
+ module Ribbon
4
+ module CoreExt
5
+
6
+ # Includes a method to convert hashes to ribbons.
7
+ module Hash
8
+
9
+ # Converts this hash to a Ribbon::Object.
10
+ def to_ribbon
11
+ ::Ribbon::Object.new self
12
+ end
13
+
14
+ # Same as #to_ribbon.
15
+ alias to_rbon to_ribbon
16
+
17
+ end
18
+
19
+ ::Hash.send :include, ::Ribbon::CoreExt::Hash
20
+
21
+ end
22
+ end
@@ -49,11 +49,13 @@ module Ribbon
49
49
  end
50
50
  end
51
51
 
52
+ # Computes a simple key:value string for easy visualization.
52
53
  def to_s
53
54
  values = __hash__.map { |k, v| "#{k}:#{v}" }
54
55
  "<Ribbon #{values.join}>"
55
56
  end
56
57
 
58
+ # Same as #to_s.
57
59
  alias :inspect :to_s
58
60
 
59
61
  # If <tt>object</tt> is a Hash, converts it to a Ribbon::Object. If it is
@@ -16,7 +16,7 @@ module Ribbon
16
16
  # Patch version.
17
17
  #
18
18
  # Increments denote changes in implementation.
19
- PATCH = 1
19
+ PATCH = 2
20
20
 
21
21
  # Build version.
22
22
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ribbon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rookie
16
- requirement: &17594200 !ruby/object:Gem::Requirement
16
+ requirement: &11036900 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *17594200
24
+ version_requirements: *11036900
25
25
  description: Ruby Object Notation. Inspired by JSON and OpenStruct.
26
26
  email: matheus.a.m.moreira@gmail.com
27
27
  executables: []
@@ -35,6 +35,8 @@ files:
35
35
  - README.markdown
36
36
  - Rakefile
37
37
  - lib/ribbon.rb
38
+ - lib/ribbon/core_ext.rb
39
+ - lib/ribbon/core_ext/hash.rb
38
40
  - lib/ribbon/object.rb
39
41
  - lib/ribbon/version.rb
40
42
  - ribbon.gemspec