lib/lookbook/support/store.rb in lookbook-1.5.5 vs lib/lookbook/support/store.rb in lookbook-2.0.0.beta.0
- old
+ new
@@ -1,5 +1,14 @@
module Lookbook
+ # Generic hash-like key/value store.
+ #
+ # Properties can be get/set using hash access syntax (`data[:key]`)
+ # or dot-notation syntax (`data.key`).
+ #
+ # Based on [ActiveSupport::OrderedOptions](https://api.rubyonrails.org/classes/ActiveSupport/OrderedOptions.html)
+ #
+ # @ignore methods
+ # @api public
class Store < ActiveSupport::OrderedOptions
def initialize(initial_data = nil, opts = {})
@recursive = opts[:recursive] || false
super()
initial_data.to_h.each { |k, v| self[k] = v }