diff --git a/README.md b/README.md index 5c80f1d..489bae1 100644 --- a/README.md +++ b/README.md @@ -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 +``` + diff --git a/test/state_test.rb b/test/state_test.rb index d053963..ad0d7da 100644 --- a/test/state_test.rb +++ b/test/state_test.rb @@ -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