ruby-nuggets 0.0.7.194 → 0.0.8.208

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/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to ruby-nuggets version 0.0.7
5
+ This documentation refers to ruby-nuggets version 0.0.8
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -0,0 +1,52 @@
1
+ #--
2
+ ###############################################################################
3
+ # #
4
+ # A component of ruby-nuggets, some extensions to the Ruby programming #
5
+ # language. #
6
+ # #
7
+ # Copyright (C) 2007-2008 Jens Wille #
8
+ # #
9
+ # Authors: #
10
+ # Jens Wille <jens.wille@uni-koeln.de> #
11
+ # #
12
+ # ruby-nuggets is free software; you can redistribute it and/or modify it #
13
+ # under the terms of the GNU General Public License as published by the Free #
14
+ # Software Foundation; either version 3 of the License, or (at your option) #
15
+ # any later version. #
16
+ # #
17
+ # ruby-nuggets is distributed in the hope that it will be useful, but WITHOUT #
18
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
19
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
20
+ # more details. #
21
+ # #
22
+ # You should have received a copy of the GNU General Public License along #
23
+ # with ruby-nuggets. If not, see <http://www.gnu.org/licenses/>. #
24
+ # #
25
+ ###############################################################################
26
+ #++
27
+
28
+ require File.join(File.dirname(__FILE__), '..', 'array', 'in_order')
29
+
30
+ class Hash
31
+
32
+ # call-seq:
33
+ # hash.in_order(*ordered) => anArray
34
+ #
35
+ # Returns <tt>hash#to_a</tt>, in forced order (cf. Array#in_order).
36
+ #
37
+ # Examples:
38
+ # { :a => 1, :b => 2, :c => 3 }.in_order(:b, :c) #=> [[:b, 2], [:c, 3], [:a, 1]]
39
+ # { :a => 1, :b => 2, :c => 3 }.in_order(:b, :d) #=> [[:b, 2], [:a, 1], [:c, 3]]
40
+ def in_order(*ordered)
41
+ keys.in_order(*ordered).map { |key| [key, self[key]] }
42
+ end
43
+
44
+ end
45
+
46
+ if $0 == __FILE__
47
+ a = { :a => 1, :b => 2, :c => 3 }
48
+ p a
49
+
50
+ p a.in_order(:b, :c)
51
+ p a.in_order(:b, :d)
52
+ end
@@ -4,7 +4,7 @@ module Nuggets
4
4
 
5
5
  MAJOR = 0
6
6
  MINOR = 0
7
- TINY = 7
7
+ TINY = 8
8
8
 
9
9
  class << self
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-nuggets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7.194
4
+ version: 0.0.8.208
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-02-01 00:00:00 +01:00
12
+ date: 2008-02-19 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -35,6 +35,7 @@ files:
35
35
  - lib/nuggets/string/evaluate.rb
36
36
  - lib/nuggets/string/word_wrap.rb
37
37
  - lib/nuggets/string/nsub.rb
38
+ - lib/nuggets/hash/in_order.rb
38
39
  - lib/nuggets/hash/insert.rb
39
40
  - lib/nuggets/proc/bind.rb
40
41
  - lib/nuggets/array/rand.rb
@@ -59,15 +60,15 @@ has_rdoc: true
59
60
  homepage: http://prometheus.rubyforge.org/ruby-nuggets
60
61
  post_install_message:
61
62
  rdoc_options:
62
- - --line-numbers
63
- - --inline-source
64
63
  - --charset
65
64
  - UTF-8
65
+ - --title
66
+ - ruby-nuggets Application documentation
66
67
  - --main
67
68
  - README
69
+ - --line-numbers
68
70
  - --all
69
- - --title
70
- - ruby-nuggets Application documentation
71
+ - --inline-source
71
72
  require_paths:
72
73
  - lib
73
74
  required_ruby_version: !ruby/object:Gem::Requirement