README.md in smart_container-0.8.0 vs README.md in smart_container-0.8.1

- old
+ new

@@ -33,11 +33,11 @@ - [key predicates](#key-predicates) - [state freeze](#state-freeze) - [reloading](#reloading) - [hash tree](#hash-tree) - [explicit class definition](#explicit-class-definition) - - [dependency changement observing](#dependency-changement-observing) + - [subscribe to dependency changements](#subscribe-to-dependency-changements) - [Roadmap](#roadmap) --- ## Functionality @@ -255,11 +255,11 @@ AppContainer['db_driver'] # => Sequel (AppContainer dependency) ``` --- -#### dependency changement observing +#### subscribe to dependency changements - features and limitations: - you can subscribe only on container instances (on container instance changements); - at this moment only the full entity path patterns are supported (pattern-based pathes are not supported yet); - you can subscribe on namespace changements (when the full namespace is re-registered) and dependency changement (when some dependency has been changed); @@ -290,22 +290,33 @@ puts "changed => '#{namespace_path}'" end ``` ```ruby -container.register('database.stats') { 'kek' } # => invokes entity_observer and outputs "changed! => 'kek'" +container.fetch('database').register('stats') = 'kek' # => invokes entity_observer and outputs "changed! => 'kek'" container.namespace('database') {} # => invoks namespace_observer and outputs "changed => 'database'" container.unobserve(observer) # unsubscribe entity_observer from dependency changement observing; container.clear_observers # unsubscribe all observers -container.register('database.stats') { 'kek' } # no one to listen this changement... :) +container.fetch('database').register('stats') = 'pek' # no one to listen this changement... :) container.namespace('database') {} # no one to listen this changement... :) ``` --- ## Roadmap + +- convinient way to rebind registered dependnecies: + +```ruby +# PoC + +container['dependency.path'] = 'pek' # simplest instant dependency registration without memoization +# --- or/and --- +container.rebind('dependency.path', memoize: true/false) { 'pek' } # bind with dynamic dependency registration +container.rebind('dependency.path', memoize: true/false, 'pek') # bind with instant dependency registration +``` - pattern-based pathes in dependency changement observing; ```ruby container.observe('path.*') { puts 'kek!' } # subscribe to all changements in `path` namespace;