reify-core 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/reify-core.rb +1 -0
- data/lib/reify-core/hash_ext.rb +26 -0
- metadata +47 -0
data/lib/reify-core.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'reify-core/hash_ext.rb'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Hash
|
2
|
+
##
|
3
|
+
#
|
4
|
+
# Merges the caller into +other_hash+. For example,
|
5
|
+
#
|
6
|
+
# options = options.reverse_merge(:size => 25, :velocity => 10)
|
7
|
+
#
|
8
|
+
# is equivalent to
|
9
|
+
#
|
10
|
+
# options = {:size => 25, :velocity => 10}.merge(options)
|
11
|
+
#
|
12
|
+
# This is particularly useful for initializing an options hash
|
13
|
+
# with default values.
|
14
|
+
#
|
15
|
+
def reverse_merge(other_hash)
|
16
|
+
other_hash.merge(self)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Destructive +reverse_merge+.
|
20
|
+
def reverse_merge!(other_hash)
|
21
|
+
# right wins if there is no left
|
22
|
+
merge!( other_hash ){|key,left,right| left }
|
23
|
+
end
|
24
|
+
|
25
|
+
alias_method :reverse_update, :reverse_merge!
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: reify-core
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tyler Kellen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-10-21 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: A toolkit for web development with Sinatra.
|
15
|
+
email: tyler@sleekcode.net
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/reify-core/hash_ext.rb
|
21
|
+
- lib/reify-core.rb
|
22
|
+
homepage: http://github.com/tkellen/reify
|
23
|
+
licenses: []
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project: reify-core
|
42
|
+
rubygems_version: 1.8.10
|
43
|
+
signing_key:
|
44
|
+
specification_version: 3
|
45
|
+
summary: A toolkit for web development with Sinatra.
|
46
|
+
test_files: []
|
47
|
+
has_rdoc:
|