Skip to content

Commit

Permalink
better README.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Mar 26, 2022
1 parent 07548c1 commit 8f34f47
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# Trailblazer::Declarative


## State

`State` is a minimalistic state handling object, similar to a hash with
additional "inheritance" logic via `State#copy`. Every field in `state`
can have a specific copying strategy, ranging from simply referencing the
original object to subclassing.

```ruby
state = Declarative.State(key: ["value", ...])
state.add!
state.update!
state.get
state.copy
state.copy # inheritance
```

2 changes: 1 addition & 1 deletion test/state_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class StateTest < Minitest::Spec

state = declarative.State("artifact/deserializer/activity" => [deserializer, copy: declarative::State.method(:dup)]) # TODO: how to initialize certain fields?

# copy
# strategy :copy
state.add!(:sequence, [1,2])
# TODO: {inherit: :self} etc

Expand Down

0 comments on commit 8f34f47

Please sign in to comment.