stator 0.12.0 → 0.13.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 +4 -4
- data/lib/stator/alias.rb +9 -0
- data/lib/stator/version.rb +1 -1
- data/stator.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc51c99705b1dbcdcbd42a7228c45d64669fd53d88d6722a0cca8b5d823ebd07
|
|
4
|
+
data.tar.gz: 1f2ebb1419274c51e10c9ffc7efa730bd6c2f7c38c5310b6532b56bdd39566b6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 060b47dae4f7a8d4c2ad655b72882547559d4beddfe07eac42fcd244443fadfb5928daee0f53518ee4be28ce24100969e157968295cc04e572b35594cc51ef46
|
|
7
|
+
data.tar.gz: e5326bdcee48fa18f2726c3a8eb05dcb6c182c1ba56dcd529bfa49b94058b26611ae53f3bfd662b09c3b362d66c5e1b32967e42505bda722a66650a849165ad1
|
data/lib/stator/alias.rb
CHANGED
|
@@ -27,6 +27,7 @@ module Stator
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def evaluate
|
|
30
|
+
infer_states if @states.empty?
|
|
30
31
|
generate_methods
|
|
31
32
|
|
|
32
33
|
if @opposite
|
|
@@ -39,6 +40,14 @@ module Stator
|
|
|
39
40
|
|
|
40
41
|
protected
|
|
41
42
|
|
|
43
|
+
def infer_states
|
|
44
|
+
unless @machine.states.include?(@name.to_s)
|
|
45
|
+
raise "[Stator] state_alias #{@full_name.inspect} is not a state in the #{@machine.klass.name} class; declare its states with `is` or `is_not`"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
@states = [@name.to_s]
|
|
49
|
+
end
|
|
50
|
+
|
|
42
51
|
def inferred_constant_name
|
|
43
52
|
[@full_name.upcase, @machine.field.to_s.pluralize.upcase].join('_')
|
|
44
53
|
end
|
data/lib/stator/version.rb
CHANGED
data/stator.gemspec
CHANGED
|
@@ -7,8 +7,8 @@ require "stator/version"
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = "stator"
|
|
9
9
|
spec.version = Stator::VERSION
|
|
10
|
-
spec.authors = ["
|
|
11
|
-
spec.email = ["
|
|
10
|
+
spec.authors = ["Gusto"]
|
|
11
|
+
spec.email = ["gusto-opensource-buildkite@gusto.com"]
|
|
12
12
|
spec.description = "The simplest of ActiveRecord state machines. Intended to be lightweight and minimalistic."
|
|
13
13
|
spec.summary = "The simplest of ActiveRecord state machines"
|
|
14
14
|
spec.license = "MIT"
|
metadata
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Gusto
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
@@ -96,7 +96,7 @@ dependencies:
|
|
|
96
96
|
description: The simplest of ActiveRecord state machines. Intended to be lightweight
|
|
97
97
|
and minimalistic.
|
|
98
98
|
email:
|
|
99
|
-
-
|
|
99
|
+
- gusto-opensource-buildkite@gusto.com
|
|
100
100
|
executables: []
|
|
101
101
|
extensions: []
|
|
102
102
|
extra_rdoc_files: []
|
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
133
133
|
- !ruby/object:Gem::Version
|
|
134
134
|
version: '0'
|
|
135
135
|
requirements: []
|
|
136
|
-
rubygems_version: 4.0.
|
|
136
|
+
rubygems_version: 4.0.20
|
|
137
137
|
specification_version: 4
|
|
138
138
|
summary: The simplest of ActiveRecord state machines
|
|
139
139
|
test_files: []
|