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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af7b6f561aff5e90f1b2b78ce69365e3f01bc16e
4
- data.tar.gz: 00ef26561f37c7a288dccddf1463b1a60860550f
3
+ metadata.gz: 4f051584efb2ecbc68840491289289c4209c3090
4
+ data.tar.gz: 4babe09b7cc299b3ce6f3a3cb713b176d65cdf0e
5
5
  SHA512:
6
- metadata.gz: 30aac3a0d143991ef104f1bf959acbd2efb489bcc8e99c456e9b01b67b744c3069d22e032038925fb0efc3e5f4c5f005b190debc2c12ab358b8a04179e5aaf19
7
- data.tar.gz: bbf64a5a2155a970e42973dba12ea20465d8676c318ef12acc6e88d59cff0dcc4175845c9587a4a833079cbf09b05b048a58ef4649e13f71230ab29b587bc235
6
+ metadata.gz: 8c6f77cb3377f86ef45f283ed34c7d40191be2fe7b39b726e3ae9886bf93adb535c6e1389dc13ebb87f5bca9d2943b9f69ce79a60c84fbc61459ec9c054d5086
7
+ data.tar.gz: b8b1db030161492d86c61a0793e811cddf116201175c0e8e32007c9bf103300617fba77c222f686350f884253d507a8d6c1fa834812413eb1b8bb5b284037c9d
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # Simplestate
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/simplestate`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Delete this and the text above, and describe your gem
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
- TODO: Write usage instructions here
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`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
35
+ To install this gem onto your local machine, run `bundle exec rake install`.
32
36
 
33
37
  ## Contributing
34
38
 
@@ -1,3 +1,3 @@
1
1
  module Simplestate
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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: