enum_plus 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/.gitignore +16 -0
  2. data/README.md +54 -0
  3. metadata +47 -0
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ *.rbc
2
+ *.sassc
3
+ .sass-cache
4
+ capybara-*.html
5
+ .rspec
6
+ /.bundle
7
+ /vendor/bundle
8
+ /log/*
9
+ /tmp/*
10
+ /db/*.sqlite3
11
+ /public/system/*
12
+ /coverage/
13
+ /spec/tmp/*
14
+ **.orig
15
+ rerun.txt
16
+ pickle-email-*.html
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # Enum Plus
2
+
3
+ Add enumeration to your ruby classes
4
+
5
+ ## Usage
6
+
7
+ ```ruby
8
+
9
+ class Person
10
+ attr_accessor :gender
11
+
12
+ def initialize opts
13
+ @gender = opts[:gender]
14
+ end
15
+
16
+ enum :gender, %w(male female)
17
+ end
18
+
19
+ cameron = Person.new gender: :male
20
+
21
+ p Person.gender_values
22
+ #=> ['male', 'female']
23
+
24
+ p Person.gender_captions
25
+ #=> ['Male', 'Female']
26
+
27
+ p cameron.gender
28
+ #=> 'male'
29
+
30
+ p cameron.male?
31
+ #=> true
32
+ p cameron.female?
33
+ #=> false
34
+
35
+ p cameron.female!
36
+ #=> 'female'
37
+ p cameron.male?
38
+ #=> false
39
+ p cameron.female?
40
+ #=> true
41
+
42
+ p cameron.gender_caption
43
+ #=> 'Female'
44
+ ```
45
+
46
+ ## Licence
47
+
48
+ Copyright 2012 caedes
49
+
50
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
51
+
52
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
53
+
54
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: enum_plus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - caedes
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-16 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Add enumeration to your ruby classes
15
+ email:
16
+ - laurentromain@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - README.md
23
+ homepage: https://github.com/caedes/enum_plus
24
+ licenses: []
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 1.8.6
44
+ signing_key:
45
+ specification_version: 3
46
+ summary: Add enumeration to your ruby classes
47
+ test_files: []