Module: Flexor::Plugins::Core::ClassMethods
- Defined in:
- lib/flexor/plugins/core.rb
Overview
Class-level methods for the core Flexor data store.
Instance Method Summary collapse
Instance Method Details
#===(other) ⇒ Object
145 146 147 |
# File 'lib/flexor/plugins/core.rb', line 145 def ===(other) other.is_a?(self) end |
#[](input = {}) ⇒ Object
131 132 133 134 135 136 137 |
# File 'lib/flexor/plugins/core.rb', line 131 def [](input = {}) case input when String then from_json(input) when Hash then new(input) else raise ArgumentError, "expected a String or Hash, got #{input.class}" end end |
#from_json(json) ⇒ Object
139 140 141 142 143 |
# File 'lib/flexor/plugins/core.rb', line 139 def from_json(json) require "json" JSON.parse(json, symbolize_names: true) .then { new it } end |