Module: Grape::Entity::Preloader::Exposure::Base
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/grape/entity/preloader/exposure.rb
Overview
rubocop:disable Style/Documentation
Instance Attribute Summary collapse
-
#preload ⇒ Object
readonly
Returns the value of attribute preload.
Instance Method Summary collapse
- #initialize(_attribute, options, _conditions) ⇒ Object
- #preload_association ⇒ Object
- #preload_callback ⇒ Object
- #preload_condition ⇒ Object
Instance Attribute Details
#preload ⇒ Object (readonly)
Returns the value of attribute preload.
10 11 12 |
# File 'lib/grape/entity/preloader/exposure.rb', line 10 def preload @preload end |
Instance Method Details
#initialize(_attribute, options, _conditions) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/grape/entity/preloader/exposure.rb', line 12 def initialize(_attribute, , _conditions) @preload = [:preload] validate_preload_option! super end |
#preload_association ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/grape/entity/preloader/exposure.rb', line 19 def preload_association case preload when Symbol preload when Array value = preload[0] value.is_a?(Symbol) ? value : nil end end |
#preload_callback ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/grape/entity/preloader/exposure.rb', line 29 def preload_callback case preload when Proc preload when Array value = preload[0] value.is_a?(Proc) ? value : nil end end |
#preload_condition ⇒ Object
39 40 41 |
# File 'lib/grape/entity/preloader/exposure.rb', line 39 def preload_condition preload.last if preload.is_a?(Array) end |