Class: InertiaRails::ScrollProp

Inherits:
BaseProp
  • Object
show all
Includes:
PropMergeable
Defined in:
lib/inertia_rails/scroll_prop.rb

Instance Attribute Summary collapse

Attributes included from PropMergeable

#appends_at_paths, #match_on, #prepends_at_paths

Instance Method Summary collapse

Methods included from PropMergeable

#appends_at_root?, #deep_merge?, #merge?, #merges_at_root?, #prepends_at_root?

Constructor Details

#initialize(**options, &block) ⇒ ScrollProp

Returns a new instance of ScrollProp.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/inertia_rails/scroll_prop.rb', line 9

def initialize(**options, &block)
  super(&block)

  @merge = true
  @deferred = options.delete(:defer) || false
  @group = options.delete(:group) || DeferProp::DEFAULT_GROUP
  @metadata = options.delete(:metadata)
  @wrapper = options.delete(:wrapper)

  @options = options
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



7
8
9
# File 'lib/inertia_rails/scroll_prop.rb', line 7

def group
  @group
end

Instance Method Details

#call(controller, scroll_intent: nil) ⇒ Object



25
26
27
28
29
# File 'lib/inertia_rails/scroll_prop.rb', line 25

def call(controller, scroll_intent: nil, **)
  @value = super(controller)
  configure_merge_intent(scroll_intent)
  @value
end

#deferred?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/inertia_rails/scroll_prop.rb', line 21

def deferred?
  @deferred
end

#metadataObject



31
32
33
# File 'lib/inertia_rails/scroll_prop.rb', line 31

def 
  ScrollMetadata.extract(@metadata, **@options)
end