Module: Jat::Plugins::SimpleApi::Map::ClassMethods
- Included in:
- Jat::Plugins::SimpleApi::Map
- Defined in:
- lib/jat/plugins/simple_api/lib/map.rb
Instance Attribute Summary collapse
-
#jat_class ⇒ Object
Returns the Jat class that this Map class is namespaced under.
Instance Method Summary collapse
-
#call(context) ⇒ Object
Returns structure like { key1 => { key11 => {}, key12 => { … } }, key2 => { key21 => {}, key22 => { … } }, }.
-
#inspect ⇒ Object
Since Map is anonymously subclassed when Jat is subclassed, and then assigned to a constant of the Jat subclass, make inspect reflect the likely name for the class.
Instance Attribute Details
#jat_class ⇒ Object
Returns the Jat class that this Map class is namespaced under.
9 10 11 |
# File 'lib/jat/plugins/simple_api/lib/map.rb', line 9 def jat_class @jat_class end |
Instance Method Details
#call(context) ⇒ Object
Returns structure like
key1 => { key11 => {, key12 => { ... } },
key2 => { key21 => {}, key22 => { ... } },
}
23 24 25 26 27 28 |
# File 'lib/jat/plugins/simple_api/lib/map.rb', line 23 def call(context) exposed = context[:exposed]&.to_sym || :default fields = context[:fields] construct_map(exposed, fields) end |
#inspect ⇒ Object
Since Map is anonymously subclassed when Jat is subclassed, and then assigned to a constant of the Jat subclass, make inspect reflect the likely name for the class.
14 15 16 |
# File 'lib/jat/plugins/simple_api/lib/map.rb', line 14 def inspect "#{jat_class.inspect}::Map" end |