Module: Prosody::State::Reading
- Included in:
- Client
- Defined in:
- lib/prosody/state.rb
Instance Method Summary collapse
-
#state(subsystem, definition) ⇒ Object
Opens a read-only view of a published JSON collection.
Instance Method Details
#state(subsystem, definition) ⇒ Object
Opens a read-only view of a published JSON collection.
167 168 169 170 171 172 173 174 175 176 |
# File 'lib/prosody/state.rb', line 167 def state(subsystem, definition) access = definition.access if access.published_vend_method.nil? || access.published_wrapper.nil? raise ArgumentError, "published state readers support JSON collections only" end cache_seconds = definition.read_cache unless definition.read_cache == false native = public_send(access.published_vend_method, subsystem.to_s, definition.name, cache_seconds, definition.read_cache == false) Prosody.const_get(access.published_wrapper).new(native) end |