orderedhash 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/gemspec.rb +13 -4
- data/install.rb +0 -0
- data/lib/orderedhash.rb +11 -0
- metadata +5 -5
data/gemspec.rb
CHANGED
@@ -1,20 +1,27 @@
|
|
1
|
-
|
2
1
|
lib, version = File::basename(File::dirname(File::expand_path(__FILE__))).split %r/-/, 2
|
3
2
|
|
4
3
|
require 'rubygems'
|
5
4
|
|
6
5
|
Gem::Specification::new do |spec|
|
7
6
|
$VERBOSE = nil
|
7
|
+
|
8
|
+
shiteless = lambda do |list|
|
9
|
+
list.delete_if do |file|
|
10
|
+
file =~ %r/\.svn/ or
|
11
|
+
file =~ %r/\.tmp/
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
8
15
|
spec.name = lib
|
9
16
|
spec.version = version
|
10
17
|
spec.platform = Gem::Platform::RUBY
|
11
18
|
spec.summary = lib
|
12
19
|
|
13
|
-
spec.files = Dir::glob
|
14
|
-
spec.executables = Dir::glob("bin/*").map{|exe| File::basename exe}
|
20
|
+
spec.files = shiteless[Dir::glob("**/**")]
|
21
|
+
spec.executables = shiteless[Dir::glob("bin/*")].map{|exe| File::basename exe}
|
15
22
|
|
16
23
|
spec.require_path = "lib"
|
17
|
-
spec.autorequire = lib
|
24
|
+
#spec.autorequire = lib
|
18
25
|
|
19
26
|
spec.has_rdoc = File::exist? "doc"
|
20
27
|
spec.test_suite_file = "test/#{ lib }.rb" if File::directory? "test"
|
@@ -25,4 +32,6 @@ Gem::Specification::new do |spec|
|
|
25
32
|
spec.author = "Ara T. Howard"
|
26
33
|
spec.email = "ara.t.howard@gmail.com"
|
27
34
|
spec.homepage = "http://codeforpeople.com/lib/ruby/#{ lib }/"
|
35
|
+
|
36
|
+
spec.rubyforge_project = 'codeforpeople'
|
28
37
|
end
|
data/install.rb
CHANGED
File without changes
|
data/lib/orderedhash.rb
CHANGED
@@ -80,6 +80,12 @@ class OrderedHash < ::Hash
|
|
80
80
|
def keys
|
81
81
|
@order
|
82
82
|
end
|
83
|
+
def first
|
84
|
+
{@order.first => self[@order.first]}
|
85
|
+
end
|
86
|
+
def last
|
87
|
+
{@order.last => self[@order.last]}
|
88
|
+
end
|
83
89
|
def invert
|
84
90
|
hsh2 = Hash.new
|
85
91
|
@order.each { |k| hsh2[self[k]] = k }
|
@@ -182,6 +188,11 @@ class OrderedHash < ::Hash
|
|
182
188
|
@__yaml_inline = bool
|
183
189
|
end
|
184
190
|
def yaml_inline!() self.yaml_inline = true end
|
191
|
+
|
192
|
+
def each_with_index
|
193
|
+
@order.each_with_index { |k, index| yield k, self[k], index }
|
194
|
+
self
|
195
|
+
end
|
185
196
|
end # class OrderedHash
|
186
197
|
|
187
198
|
def OrderedHash(*a, &b)
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orderedhash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ara T. Howard
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-12-17 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -48,8 +48,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
version:
|
49
49
|
requirements: []
|
50
50
|
|
51
|
-
rubyforge_project:
|
52
|
-
rubygems_version: 1.
|
51
|
+
rubyforge_project: codeforpeople
|
52
|
+
rubygems_version: 1.3.1
|
53
53
|
signing_key:
|
54
54
|
specification_version: 2
|
55
55
|
summary: orderedhash
|