ruby_enum 0.5.0.beta6 → 1.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3faca2c5d110f416778382782d5dc0785426298d
4
- data.tar.gz: 6a95d68fcf055de98e55a20ba6d41ba2d79174fb
3
+ metadata.gz: 5b0be932536410d7243c639d66163e86c428a38c
4
+ data.tar.gz: 8310d6e77fdd8058dcc306520beb84976979bd84
5
5
  SHA512:
6
- metadata.gz: ba293eb925c0f9890e7e393ecb5d8fd925b6811d3acfae82a991c24842af44bb17a4e54a745bee002c6337dcfa84b4d86c110a74ae00fe5ecbcdf8899928f76b
7
- data.tar.gz: ded4f20e714838dcf8fc87d2424a6e23886b8e34cd3bdc0d115d6796578eed65351461688675b54b2db30fc43bce36d94681c547149b2fab6bd78e314eddc83b
6
+ metadata.gz: 07ee4181696aad226a0d17981d7afd512c76145617264ad064841fa74e4dd48082fc71687f8972239fcf67c9ab1fbc150b4e4003c93ceb5f2aa733eb839ee448
7
+ data.tar.gz: c969a7e56b9fe0c58b6bd561ee873f608e3ebbc6c09e0a25a5111a8e266fdac3c07fbf68585dc65bdf99faafe454dba81b9e8b5a607814327e438ea7c7d00b58
data/.travis.yml CHANGED
@@ -1,10 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
3
  - 2.0.0
5
4
  - 2.1.1
6
5
  - 2.2.2
7
6
  - 2.2.3
7
+ - 2.2.4
8
+ - 2.3.0
8
9
  script: bundle exec rspec spec
9
10
  branches:
10
11
  only:
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_enum (0.5.0.beta6)
5
- activesupport (>= 3.2)
6
- railties (>= 3.2)
4
+ ruby_enum (1.0.0)
5
+ activesupport (~> 4)
6
+ railties (~> 4)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -34,10 +34,10 @@ GEM
34
34
  json (1.8.3)
35
35
  loofah (2.0.3)
36
36
  nokogiri (>= 1.5.9)
37
- mini_portile (0.6.2)
38
- minitest (5.8.1)
39
- nokogiri (1.6.6.2)
40
- mini_portile (~> 0.6.0)
37
+ mini_portile2 (2.1.0)
38
+ minitest (5.9.1)
39
+ nokogiri (1.6.8.1)
40
+ mini_portile2 (~> 2.1.0)
41
41
  rack (1.6.4)
42
42
  rack-test (0.6.3)
43
43
  rack (>= 1.0)
@@ -47,7 +47,7 @@ GEM
47
47
  activesupport (>= 4.2.0.beta, < 5.0)
48
48
  nokogiri (~> 1.6.0)
49
49
  rails-deprecated_sanitizer (>= 1.0.1)
50
- rails-html-sanitizer (1.0.2)
50
+ rails-html-sanitizer (1.0.3)
51
51
  loofah (~> 2.0)
52
52
  railties (4.2.4)
53
53
  actionpack (= 4.2.4)
@@ -80,3 +80,6 @@ DEPENDENCIES
80
80
  rake (~> 10.0)
81
81
  rspec (~> 3.3.0)
82
82
  ruby_enum!
83
+
84
+ BUNDLED WITH
85
+ 1.13.6
data/README.md CHANGED
@@ -11,7 +11,8 @@ A simple enumeration type for ruby.
11
11
  Add this line to your application's Gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'ruby_enum'
14
+ gem 'ruby_enum', "~> 0.4" # for Rails 3
15
+ gem 'ruby_enum', "~> 1.0" # for Rails 4
15
16
  ```
16
17
 
17
18
  And then execute:
@@ -37,21 +38,14 @@ class Coordinate
37
38
  enum :east
38
39
  end
39
40
  ```
40
- Note that you can't define the same enumeration instance twice. An error will
41
- be raised in this case, for example:
41
+ For each value an new sigleton instance of the class will be created. If
42
+ you define the same enumeration value twice, an error will be raised.
42
43
 
43
- ```ruby
44
- class InvalidEnumeration
45
- include RubyEnum
46
-
47
- enum :value
48
- enum :value
49
- end
50
- ```
44
+ Including `RubyEnum` in any class will make it a singleton. You will not
45
+ be able to create new instances of your class using `new`, `allocate`,
46
+ `clone` or `dup`.
51
47
 
52
- Including `RubyEnum` in any class will make it a singleton. You will not be able
53
- to create new instances of your class using `new`, `allocate`, `clone` or
54
- `dup`. You can access an enumeration's values in three different ways:
48
+ You can access an enumeration's values in three different ways:
55
49
 
56
50
  Using a class method that matches the enumeration instance name:
57
51
 
@@ -70,8 +64,8 @@ Treating your enumeration class as a dictionary:
70
64
  ```ruby
71
65
  north = Coordinate[:north]
72
66
  ```
73
- Note that his method returns `nil` if no enumeration instance is found by the
74
- specified name.
67
+ Note that his method returns `nil` if no enumeration instance is
68
+ found by the specified name.
75
69
 
76
70
  To retrieve all enumeration instances simply use method `all` on your
77
71
  enumeration class:
@@ -82,10 +76,11 @@ coordinates = Coordinate.all
82
76
 
83
77
  ### Specifying associated values
84
78
 
85
- Each enumeration instance has an implicit name and associated value attributes
86
- accessible through the `name` and `value` methods. If no associated value is
87
- specified for an enumeration instance in the definition of the enumeration
88
- class, it will be implicitly set to its name:
79
+ Each enumeration instance has an implicit name and associated value
80
+ attributes accessible through the `name` and `value` methods. If no
81
+ associated value is specified for an enumeration instance in the
82
+ definition of the enumeration class, it will be implicitly set to its
83
+ name:
89
84
 
90
85
  ```ruby
91
86
  north = Coordinate.north
@@ -5,7 +5,7 @@ module RubyEnum
5
5
  module AttrEnum
6
6
  extend ActiveSupport::Concern
7
7
 
8
- def assign_attributes(new_attributes, optsions = {})
8
+ def assign_attributes(new_attributes)
9
9
  if new_attributes
10
10
  enumeration_attrs = self.class.attr_enums
11
11
 
@@ -1,3 +1,3 @@
1
1
  module RubyEnum
2
- VERSION = "0.4.1"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/ruby_enum.rb CHANGED
@@ -19,12 +19,16 @@ module RubyEnum
19
19
  return name == expected_name
20
20
  end
21
21
  end
22
+
23
+ super
22
24
  end
23
25
 
24
26
  def respond_to?(method)
25
27
  if method.to_s =~ /^(.*)\?/
26
28
  enum_names = self.class.all.map(&:name)
27
29
  return enum_names.include? $1.to_sym
30
+ else
31
+ super
28
32
  end
29
33
  end
30
34
 
data/ruby_enum.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'ruby_enum/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "ruby_enum"
8
- spec.version = "0.5.0.beta6"
8
+ spec.version = "#{RubyEnum::VERSION}"
9
9
  spec.authors = ["Lefteris Laskaridis"]
10
10
  spec.email = ["l.laskaridis@pamediakopes.gr"]
11
11
 
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "activesupport", ">= 3.2"
23
- spec.add_dependency "railties", ">= 3.2"
22
+ spec.add_dependency "activesupport", "~> 4"
23
+ spec.add_dependency "railties", "~> 4"
24
24
 
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "rspec", "~> 3.3.0"
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.beta6
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lefteris Laskaridis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-23 00:00:00.000000000 Z
11
+ date: 2016-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
19
+ version: '4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.2'
26
+ version: '4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.2'
33
+ version: '4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.2'
40
+ version: '4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -104,12 +104,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ">"
107
+ - - ">="
108
108
  - !ruby/object:Gem::Version
109
- version: 1.3.1
109
+ version: '0'
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 2.2.2
112
+ rubygems_version: 2.5.1
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Simple enumeration type for ruby