simplestate 0.1.1 → 0.1.2
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/README.md +8 -4
- data/lib/simplestate/version.rb +1 -1
- data/simplestate.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f051584efb2ecbc68840491289289c4209c3090
|
|
4
|
+
data.tar.gz: 4babe09b7cc299b3ce6f3a3cb713b176d65cdf0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c6f77cb3377f86ef45f283ed34c7d40191be2fe7b39b726e3ae9886bf93adb535c6e1389dc13ebb87f5bca9d2943b9f69ce79a60c84fbc61459ec9c054d5086
|
|
7
|
+
data.tar.gz: b8b1db030161492d86c61a0793e811cddf116201175c0e8e32007c9bf103300617fba77c222f686350f884253d507a8d6c1fa834812413eb1b8bb5b284037c9d
|
data/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# Simplestate
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Simplestate arose out of a need to build a simple statemachine. This implementation was inspired by Daniel Cadenas' StatePattern gem. (https://github.com/dcadenas/state_pattern)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
I have chosen to eschew serialization of state for now. SimpleDelegator provides the basic functionality required for this implementation. SimpleDelegator supports dynamically swapping the object to which delegated calls are made.
|
|
6
|
+
|
|
7
|
+
The StateHolder class derives from SimpleDelegator. A 'real' state holding object inherits from StateHolder. StateHolder provides support for transitioning between states. Any method not available on the state holder will be forwarded to the currently held state.
|
|
8
|
+
|
|
9
|
+
The State class from which all 'real' states inherit has private #enter and #exit methods that raise an exception. Real states are expected to override these methods with at least 'no-ops'. Any public methods added to a 'real' state can be called on the object holding the state via inherited SimpleDelegator. #enter and #exit like all private state methods are not reachable via the SimpleDelagator functionality. They are intended for internal use by the state instance.
|
|
6
10
|
|
|
7
11
|
## Installation
|
|
8
12
|
|
|
@@ -22,13 +26,13 @@ Or install it yourself as:
|
|
|
22
26
|
|
|
23
27
|
## Usage
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
The button module provides an example of the usage of Simplestate. Tests of this are provided in simplestate_test.rb.
|
|
26
30
|
|
|
27
31
|
## Development
|
|
28
32
|
|
|
29
33
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
34
|
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
35
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
32
36
|
|
|
33
37
|
## Contributing
|
|
34
38
|
|
data/lib/simplestate/version.rb
CHANGED
data/simplestate.gemspec
CHANGED
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
|
11
11
|
|
|
12
12
|
spec.summary = %q{A SimpleDelegator based implementation of the State Pattern}
|
|
13
13
|
spec.description = %q{Provides a base State class and a subclassed SimpleDelegator modified to provide state pattern support.}
|
|
14
|
-
spec.homepage = "https://github.com/dpneumo/simplestate
|
|
14
|
+
spec.homepage = "https://github.com/dpneumo/simplestate"
|
|
15
15
|
spec.license = "MIT"
|
|
16
16
|
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simplestate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mitchell C Kuppinger
|
|
@@ -103,7 +103,7 @@ files:
|
|
|
103
103
|
- lib/simplestate/state_holder.rb
|
|
104
104
|
- lib/simplestate/version.rb
|
|
105
105
|
- simplestate.gemspec
|
|
106
|
-
homepage: https://github.com/dpneumo/simplestate
|
|
106
|
+
homepage: https://github.com/dpneumo/simplestate
|
|
107
107
|
licenses:
|
|
108
108
|
- MIT
|
|
109
109
|
metadata:
|