enum 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +23 -0
- data/History.txt +6 -0
- data/Manifest.txt +7 -0
- data/README.txt +76 -0
- data/Rakefile +12 -0
- data/lib/enum.rb +106 -18
- data/test/test_card.rb +34 -0
- data/test/test_day.rb +31 -0
- data/test/test_deck.rb +13 -0
- data/test/test_enum.rb +10 -0
- data/test/test_family.rb +94 -0
- data/test/test_operation.rb +24 -0
- data/test/test_planet.rb +19 -0
- metadata +78 -23
- data/Changelog +0 -0
- data/LICENSE +0 -0
- data/README +0 -0
- data/init.rb +0 -2
- data/test/foo.rb +0 -11
data/.autotest
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'autotest/restart'
|
4
|
+
|
5
|
+
# Autotest.add_hook :initialize do |at|
|
6
|
+
# at.extra_files << "../some/external/dependency.rb"
|
7
|
+
#
|
8
|
+
# at.libs << ":../some/external"
|
9
|
+
#
|
10
|
+
# at.add_exception 'vendor'
|
11
|
+
#
|
12
|
+
# at.add_mapping(/dependency.rb/) do |f, _|
|
13
|
+
# at.files_matching(/test_.*rb$/)
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# %w(TestA TestB).each do |klass|
|
17
|
+
# at.extra_class_map[klass] = "test/test_misc.rb"
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
|
21
|
+
# Autotest.add_hook :run_command do |at|
|
22
|
+
# system "rake build"
|
23
|
+
# end
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
= enum
|
2
|
+
|
3
|
+
http://github.com/capnregex/enum
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
A java like Enum class for ruby.
|
8
|
+
|
9
|
+
A while ago I was exploring Java, and came across the Enum class, which had
|
10
|
+
some interesting functionality, and I decided that I would like something like
|
11
|
+
it.
|
12
|
+
|
13
|
+
Conceptually if you just need a unique identifier you may be perfectly happy using a :symbol, and that would likely be a simpler way of having a controll flag. However, if you want to have a set of unique identifiers that you can address, iterate over, assign properties to, etc, then this may be something you would be interested in.
|
14
|
+
|
15
|
+
== FEATURES/PROBLEMS:
|
16
|
+
|
17
|
+
Provide the java Enum idiom for Ruby.
|
18
|
+
|
19
|
+
For examples of use cases, see the examples in test.
|
20
|
+
|
21
|
+
== SYNOPSIS:
|
22
|
+
|
23
|
+
class PrimaryColors < Enum
|
24
|
+
enum %w(Red Yellow Blue)
|
25
|
+
end
|
26
|
+
|
27
|
+
class Colors < Enum
|
28
|
+
enum_field :code
|
29
|
+
enum do
|
30
|
+
RED '#ff0000'
|
31
|
+
GREEN '#00ff00'
|
32
|
+
BLUE '#0000ff'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
== REQUIREMENTS:
|
37
|
+
|
38
|
+
ruby, rubygems
|
39
|
+
|
40
|
+
== INSTALL:
|
41
|
+
|
42
|
+
sudo gem install enum
|
43
|
+
|
44
|
+
== DEVELOPERS:
|
45
|
+
|
46
|
+
After checking out the source, run:
|
47
|
+
|
48
|
+
$ rake newb
|
49
|
+
|
50
|
+
This task will install any missing dependencies, run the tests/specs,
|
51
|
+
and generate the RDoc.
|
52
|
+
|
53
|
+
== LICENSE:
|
54
|
+
|
55
|
+
(The MIT License)
|
56
|
+
|
57
|
+
Copyright (c) 2010
|
58
|
+
|
59
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
60
|
+
a copy of this software and associated documentation files (the
|
61
|
+
'Software'), to deal in the Software without restriction, including
|
62
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
63
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
64
|
+
permit persons to whom the Software is furnished to do so, subject to
|
65
|
+
the following conditions:
|
66
|
+
|
67
|
+
The above copyright notice and this permission notice shall be
|
68
|
+
included in all copies or substantial portions of the Software.
|
69
|
+
|
70
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
71
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
72
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
73
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
74
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
75
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
76
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/lib/enum.rb
CHANGED
@@ -1,25 +1,49 @@
|
|
1
1
|
# Enum
|
2
2
|
class Enum
|
3
|
+
VERSION = '1.0.0'
|
4
|
+
include Comparable
|
3
5
|
protected
|
4
6
|
def init *args
|
7
|
+
self.class.fields.each do |field|
|
8
|
+
instance_variable_set("@#{field}",args.shift)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
def initialize *args, &block
|
12
|
+
@id = self.class.next_ordinal
|
13
|
+
sym = args.shift
|
14
|
+
@sym = sym.to_sym
|
15
|
+
@name = args.shift || sym.to_s
|
16
|
+
init(*args)
|
17
|
+
if block
|
18
|
+
instance_eval( &block )
|
19
|
+
end
|
5
20
|
end
|
6
21
|
public
|
7
|
-
attr_reader :id
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
22
|
+
attr_reader :id
|
23
|
+
alias ordinal id
|
24
|
+
def <=> other
|
25
|
+
if self.class == other.class
|
26
|
+
ordinal <=> other.ordinal
|
27
|
+
else
|
28
|
+
nil
|
29
|
+
end
|
12
30
|
end
|
13
|
-
def to_sym;
|
14
|
-
def to_s
|
31
|
+
def to_sym;@sym;end
|
32
|
+
def to_s;@name;end
|
33
|
+
alias name to_s
|
34
|
+
alias title to_s
|
15
35
|
def to_i;@id;end
|
16
|
-
def
|
36
|
+
def to_f;@id.to_f;end
|
37
|
+
def inspect;"#{self.class}::#{to_sym}";end
|
17
38
|
def save;end
|
18
39
|
def save!;end
|
19
40
|
class << self
|
20
41
|
def values
|
21
42
|
@values ||= []
|
22
43
|
end
|
44
|
+
def fields
|
45
|
+
@fields ||= []
|
46
|
+
end
|
23
47
|
alias all values
|
24
48
|
def find id
|
25
49
|
values[id]
|
@@ -29,19 +53,83 @@ public
|
|
29
53
|
yield value
|
30
54
|
end
|
31
55
|
end
|
56
|
+
def save
|
57
|
+
end
|
58
|
+
def save!
|
59
|
+
end
|
60
|
+
def next_ordinal
|
61
|
+
o = @next_ordinal ||= 0
|
62
|
+
@next_ordinal = o + step
|
63
|
+
o
|
64
|
+
end
|
32
65
|
protected
|
33
|
-
def
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
value
|
66
|
+
def start_at i
|
67
|
+
@next_ordinal = i
|
68
|
+
end
|
69
|
+
def step_by n
|
70
|
+
@step = n
|
39
71
|
end
|
40
|
-
def
|
41
|
-
|
72
|
+
def enum_fields *fields
|
73
|
+
@fields = fields
|
74
|
+
send :attr_reader, *fields
|
75
|
+
end
|
76
|
+
def enum *args, &block
|
77
|
+
unless args.empty?
|
78
|
+
if args.length == 1 and ( arg = args.first ) and arg.kind_of? Array
|
79
|
+
arg.each do |a|
|
80
|
+
add_enum a
|
81
|
+
end
|
82
|
+
else
|
83
|
+
args.each do |arg|
|
84
|
+
add_enum arg
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
if block
|
89
|
+
Enumeration.new self, &block
|
90
|
+
end
|
91
|
+
nil
|
92
|
+
end
|
93
|
+
def step
|
94
|
+
@step ||= 1
|
95
|
+
end
|
96
|
+
def enum_sym arg
|
97
|
+
arg = arg.to_s.upcase
|
98
|
+
case arg
|
99
|
+
when /\s/
|
100
|
+
arg.gsub(/\s+/,'_').to_sym
|
101
|
+
else
|
102
|
+
arg.to_sym
|
103
|
+
end
|
104
|
+
end
|
105
|
+
def add_enum *args, &block
|
106
|
+
c = args.shift
|
107
|
+
name = c.to_s
|
108
|
+
sym = enum_sym(c)
|
109
|
+
if const_defined? sym
|
110
|
+
const_get sym
|
111
|
+
else
|
112
|
+
value = new(sym,name,*args,&block)
|
113
|
+
values.push value
|
114
|
+
const_set(sym,value)
|
115
|
+
value
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# use the Enumeration class to constrain the scope of where the Enum definition can take place.
|
121
|
+
class Enumeration
|
122
|
+
def initialize parent, *args, &block
|
123
|
+
@parent = parent
|
124
|
+
instance_eval(&block)
|
125
|
+
end
|
126
|
+
protected
|
127
|
+
def method_missing *args, &block
|
128
|
+
@parent.send :add_enum, *args, &block
|
42
129
|
end
|
43
|
-
def const_missing *args
|
44
|
-
|
130
|
+
def const_missing *args, &block
|
131
|
+
@parent.send :add_enum, *args, &block
|
45
132
|
end
|
46
133
|
end
|
134
|
+
|
47
135
|
end
|
data/test/test_card.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
require "test/unit"
|
3
|
+
require "card"
|
4
|
+
|
5
|
+
class TestCard < Test::Unit::TestCase
|
6
|
+
def test_card_sanity
|
7
|
+
assert_equal Card::Rank::TEN.to_i, 10
|
8
|
+
assert_equal [Card::Suit::CLUBS, Card::Suit::DIAMONDS, Card::Suit::HEARTS,
|
9
|
+
Card::Suit::SPADES], Card::Suit.values
|
10
|
+
assert_equal [Card::Rank::DEUCE, Card::Rank::THREE, Card::Rank::FOUR,
|
11
|
+
Card::Rank::FIVE, Card::Rank::SIX, Card::Rank::SEVEN, Card::Rank::EIGHT,
|
12
|
+
Card::Rank::NINE, Card::Rank::TEN, Card::Rank::JACK, Card::Rank::QUEEN,
|
13
|
+
Card::Rank::KING, Card::Rank::ACE], Card::Rank.values
|
14
|
+
assert_equal [Card::DEUCE_OF_CLUBS, Card::THREE_OF_CLUBS,
|
15
|
+
Card::FOUR_OF_CLUBS, Card::FIVE_OF_CLUBS, Card::SIX_OF_CLUBS,
|
16
|
+
Card::SEVEN_OF_CLUBS, Card::EIGHT_OF_CLUBS, Card::NINE_OF_CLUBS,
|
17
|
+
Card::TEN_OF_CLUBS, Card::JACK_OF_CLUBS, Card::QUEEN_OF_CLUBS,
|
18
|
+
Card::KING_OF_CLUBS, Card::ACE_OF_CLUBS, Card::DEUCE_OF_DIAMONDS,
|
19
|
+
Card::THREE_OF_DIAMONDS, Card::FOUR_OF_DIAMONDS, Card::FIVE_OF_DIAMONDS,
|
20
|
+
Card::SIX_OF_DIAMONDS, Card::SEVEN_OF_DIAMONDS, Card::EIGHT_OF_DIAMONDS,
|
21
|
+
Card::NINE_OF_DIAMONDS, Card::TEN_OF_DIAMONDS, Card::JACK_OF_DIAMONDS,
|
22
|
+
Card::QUEEN_OF_DIAMONDS, Card::KING_OF_DIAMONDS, Card::ACE_OF_DIAMONDS,
|
23
|
+
Card::DEUCE_OF_HEARTS, Card::THREE_OF_HEARTS, Card::FOUR_OF_HEARTS,
|
24
|
+
Card::FIVE_OF_HEARTS, Card::SIX_OF_HEARTS, Card::SEVEN_OF_HEARTS,
|
25
|
+
Card::EIGHT_OF_HEARTS, Card::NINE_OF_HEARTS, Card::TEN_OF_HEARTS,
|
26
|
+
Card::JACK_OF_HEARTS, Card::QUEEN_OF_HEARTS, Card::KING_OF_HEARTS,
|
27
|
+
Card::ACE_OF_HEARTS, Card::DEUCE_OF_SPADES, Card::THREE_OF_SPADES,
|
28
|
+
Card::FOUR_OF_SPADES, Card::FIVE_OF_SPADES, Card::SIX_OF_SPADES,
|
29
|
+
Card::SEVEN_OF_SPADES, Card::EIGHT_OF_SPADES, Card::NINE_OF_SPADES,
|
30
|
+
Card::TEN_OF_SPADES, Card::JACK_OF_SPADES, Card::QUEEN_OF_SPADES,
|
31
|
+
Card::KING_OF_SPADES, Card::ACE_OF_SPADES], Card.values
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
data/test/test_day.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
require "test/unit"
|
3
|
+
require "day"
|
4
|
+
|
5
|
+
class TestDay < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_day_defined
|
8
|
+
assert Day
|
9
|
+
end
|
10
|
+
|
11
|
+
def tell_it_like_it_is day
|
12
|
+
case day
|
13
|
+
when Day::MONDAY then "Mondays are bad."
|
14
|
+
when Day::FRIDAY then "Fridays are better."
|
15
|
+
when Day::SATURDAY,Day::SUNDAY then "Weekends are best."
|
16
|
+
when Day then "Midweek days are soso."
|
17
|
+
else "Not a Day"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_day_case
|
22
|
+
assert_equal "Mondays are bad.", tell_it_like_it_is(Day::MONDAY)
|
23
|
+
assert_equal "Midweek days are soso.", tell_it_like_it_is(Day::WEDNESDAY)
|
24
|
+
assert_equal "Fridays are better.", tell_it_like_it_is(Day::FRIDAY)
|
25
|
+
assert_equal "Weekends are best.", tell_it_like_it_is(Day::SATURDAY)
|
26
|
+
assert_equal "Weekends are best.", tell_it_like_it_is(Day::SUNDAY)
|
27
|
+
assert_equal "Not a Day", tell_it_like_it_is(5)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
data/test/test_deck.rb
ADDED
data/test/test_enum.rb
ADDED
data/test/test_family.rb
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
|
2
|
+
require "test/unit"
|
3
|
+
require "family"
|
4
|
+
|
5
|
+
class TestEnum < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_family_ids
|
8
|
+
assert_equal Family::MANUAL.id, 0
|
9
|
+
assert_equal Family::CHIRP.id, 1
|
10
|
+
assert_equal Family::CANNED.id, 2
|
11
|
+
assert_equal Family::PULSE.id, 3
|
12
|
+
assert_equal Family::LEARN.id, 4
|
13
|
+
assert_equal Family::STEP.id, 5
|
14
|
+
assert_equal Family::DISTANCE.id, 6
|
15
|
+
assert_equal Family::CALORIE.id, 7
|
16
|
+
assert_equal Family::HRSS.id, 8
|
17
|
+
assert_equal Family::TRAINER.id, 9
|
18
|
+
assert_equal Family::TEST.id, 10
|
19
|
+
assert_equal Family::DEMO.id, 11
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_family_syms
|
23
|
+
assert_equal Family::MANUAL.to_sym, :MANUAL
|
24
|
+
assert_equal Family::CHIRP.to_sym, :CHIRP
|
25
|
+
assert_equal Family::CANNED.to_sym, :CANNED
|
26
|
+
assert_equal Family::PULSE.to_sym, :PULSE
|
27
|
+
assert_equal Family::LEARN.to_sym, :LEARN
|
28
|
+
assert_equal Family::STEP.to_sym, :STEP
|
29
|
+
assert_equal Family::DISTANCE.to_sym, :DISTANCE
|
30
|
+
assert_equal Family::CALORIE.to_sym, :CALORIE
|
31
|
+
assert_equal Family::HRSS.to_sym, :HRSS
|
32
|
+
assert_equal Family::TRAINER.to_sym, :TRAINER
|
33
|
+
assert_equal Family::TEST.to_sym, :TEST
|
34
|
+
assert_equal Family::DEMO.to_sym, :DEMO
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_family_names
|
38
|
+
assert_equal Family::MANUAL.name, 'MANUAL'
|
39
|
+
assert_equal Family::CHIRP.name, 'CHIRP'
|
40
|
+
assert_equal Family::CANNED.name, 'CANNED'
|
41
|
+
assert_equal Family::PULSE.name, 'PULSE'
|
42
|
+
assert_equal Family::LEARN.name, 'LEARN'
|
43
|
+
assert_equal Family::STEP.name, 'STEP'
|
44
|
+
assert_equal Family::DISTANCE.name, 'DISTANCE'
|
45
|
+
assert_equal Family::CALORIE.name, 'CALORIE'
|
46
|
+
assert_equal Family::HRSS.name, 'HRSS'
|
47
|
+
assert_equal Family::TRAINER.name, 'TRAINER'
|
48
|
+
assert_equal Family::TEST.name, 'TEST'
|
49
|
+
assert_equal Family::DEMO.name, 'DEMO'
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_family_ordinals
|
53
|
+
assert_equal Family::MANUAL.ordinal, 0
|
54
|
+
assert_equal Family::CHIRP.ordinal, 1
|
55
|
+
assert_equal Family::CANNED.ordinal, 2
|
56
|
+
assert_equal Family::PULSE.ordinal, 3
|
57
|
+
assert_equal Family::LEARN.ordinal, 4
|
58
|
+
assert_equal Family::STEP.ordinal, 5
|
59
|
+
assert_equal Family::DISTANCE.ordinal, 6
|
60
|
+
assert_equal Family::CALORIE.ordinal, 7
|
61
|
+
assert_equal Family::HRSS.ordinal, 8
|
62
|
+
assert_equal Family::TRAINER.ordinal, 9
|
63
|
+
assert_equal Family::TEST.ordinal, 10
|
64
|
+
assert_equal Family::DEMO.ordinal, 11
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_family_description
|
68
|
+
assert_equal Family::MANUAL.description, 'Manual Workout, No Automation'
|
69
|
+
assert_equal Family::CHIRP.description, 'Audio Chirp workout'
|
70
|
+
assert_equal Family::CANNED.description, 'Builtin Speed / Incline workout at 1 minute incriments'
|
71
|
+
assert_equal Family::PULSE.description, 'Builtin Pulse workouts'
|
72
|
+
assert_equal Family::LEARN.description, 'Built in Custom Workout'
|
73
|
+
assert_equal Family::STEP.description, 'Step Counting Workout'
|
74
|
+
assert_equal Family::DISTANCE.description, 'Reach a Target Distance'
|
75
|
+
assert_equal Family::CALORIE.description, 'Reach a Target Calorie Count'
|
76
|
+
assert_equal Family::HRSS.description, 'Heart Rate Self Select'
|
77
|
+
assert_equal Family::TRAINER.description, 'Wpl1 Macro Segment workout'
|
78
|
+
assert_equal Family::TEST.description, 'A Fitness Test'
|
79
|
+
assert_equal Family::DEMO.description, 'Wpl1 Non Macro segment workout'
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_family_values_equality
|
83
|
+
assert_equal Family.values, [ Family::MANUAL, Family::CHIRP,
|
84
|
+
Family::CANNED, Family::PULSE, Family::LEARN, Family::STEP,
|
85
|
+
Family::DISTANCE, Family::CALORIE, Family::HRSS, Family::TRAINER,
|
86
|
+
Family::TEST, Family::DEMO ]
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_family_value_inequality
|
90
|
+
assert_not_equal Family::MANUAL, Family::CHIRP
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
require "test/unit"
|
3
|
+
require "operation"
|
4
|
+
|
5
|
+
class TestOperation < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_sanity
|
8
|
+
assert Operation
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_values
|
12
|
+
assert_equal [Operation::PLUS, Operation::MINUS, Operation::TIMES,
|
13
|
+
Operation::DIVIDE], Operation.values
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_operations
|
17
|
+
assert_equal 3, Operation::PLUS.evaluate(1,2)
|
18
|
+
assert_equal 6, Operation::MINUS.evaluate(8,2)
|
19
|
+
assert_equal 6, Operation::TIMES.evaluate(3,2)
|
20
|
+
assert_equal 6, Operation::DIVIDE.evaluate(12,2)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
data/test/test_planet.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
require "test/unit"
|
3
|
+
require "planet"
|
4
|
+
|
5
|
+
class TestPlanet < Test::Unit::TestCase
|
6
|
+
def test_planet
|
7
|
+
mass = Planet::EARTH.mass_of 175
|
8
|
+
assert_in_delta 66.107583, Planet::MERCURY.surface_weight(mass), 0.000001
|
9
|
+
assert_in_delta 158.374842, Planet::VENUS.surface_weight(mass) , 0.000001
|
10
|
+
assert_in_delta 175.000000, Planet::EARTH.surface_weight(mass) , 0.000001
|
11
|
+
assert_in_delta 66.279007, Planet::MARS.surface_weight(mass) , 0.000001
|
12
|
+
assert_in_delta 442.847567, Planet::JUPITER.surface_weight(mass), 0.000001
|
13
|
+
assert_in_delta 186.552719, Planet::SATURN.surface_weight(mass) , 0.000001
|
14
|
+
assert_in_delta 158.397260, Planet::URANUS.surface_weight(mass) , 0.000001
|
15
|
+
assert_in_delta 199.207413, Planet::NEPTUNE.surface_weight(mass), 0.000001
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
metadata
CHANGED
@@ -1,46 +1,95 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
7
|
- 1
|
10
|
-
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
-
-
|
13
|
+
- capnregex
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-14 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rubyforge
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 0
|
33
|
+
- 4
|
34
|
+
version: 2.0.4
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: hoe
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 19
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 6
|
49
|
+
- 2
|
50
|
+
version: 2.6.2
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
description: |-
|
54
|
+
A java like Enum class for ruby.
|
55
|
+
|
56
|
+
A while ago I was exploring Java, and came across the Enum class, which had
|
57
|
+
some interesting functionality, and I decided that I would like something like
|
58
|
+
it.
|
59
|
+
|
60
|
+
Conceptually if you just need a unique identifier you may be perfectly happy using a :symbol, and that would likely be a simpler way of having a controll flag. However, if you want to have a set of unique identifiers that you can address, iterate over, assign properties to, etc, then this may be something you would be interested in.
|
61
|
+
email:
|
62
|
+
- capnregex@gmail.com
|
24
63
|
executables: []
|
25
64
|
|
26
65
|
extensions: []
|
27
66
|
|
28
|
-
extra_rdoc_files:
|
29
|
-
|
67
|
+
extra_rdoc_files:
|
68
|
+
- History.txt
|
69
|
+
- Manifest.txt
|
70
|
+
- README.txt
|
30
71
|
files:
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
72
|
+
- .autotest
|
73
|
+
- History.txt
|
74
|
+
- Manifest.txt
|
75
|
+
- README.txt
|
76
|
+
- Rakefile
|
36
77
|
- lib/enum.rb
|
78
|
+
- test/test_enum.rb
|
79
|
+
- test/test_day.rb
|
80
|
+
- test/test_planet.rb
|
81
|
+
- test/test_operation.rb
|
82
|
+
- test/test_family.rb
|
83
|
+
- test/test_card.rb
|
84
|
+
- test/test_deck.rb
|
37
85
|
has_rdoc: true
|
38
86
|
homepage: http://github.com/capnregex/enum
|
39
87
|
licenses: []
|
40
88
|
|
41
89
|
post_install_message:
|
42
|
-
rdoc_options:
|
43
|
-
|
90
|
+
rdoc_options:
|
91
|
+
- --main
|
92
|
+
- README.txt
|
44
93
|
require_paths:
|
45
94
|
- lib
|
46
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -63,10 +112,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
112
|
version: "0"
|
64
113
|
requirements: []
|
65
114
|
|
66
|
-
rubyforge_project:
|
115
|
+
rubyforge_project: enum
|
67
116
|
rubygems_version: 1.3.7
|
68
117
|
signing_key:
|
69
118
|
specification_version: 3
|
70
|
-
summary: java like
|
71
|
-
test_files:
|
72
|
-
|
119
|
+
summary: A java like Enum class for ruby
|
120
|
+
test_files:
|
121
|
+
- test/test_day.rb
|
122
|
+
- test/test_planet.rb
|
123
|
+
- test/test_operation.rb
|
124
|
+
- test/test_family.rb
|
125
|
+
- test/test_card.rb
|
126
|
+
- test/test_enum.rb
|
127
|
+
- test/test_deck.rb
|
data/Changelog
DELETED
File without changes
|
data/LICENSE
DELETED
File without changes
|
data/README
DELETED
File without changes
|
data/init.rb
DELETED