Class: Nquery::InfiniteScrollComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/nquery/infinite_scroll_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Component

render_in, #render_in

Constructor Details

#initialize(url:, target: "items", class: nil) ⇒ InfiniteScrollComponent

Returns a new instance of InfiniteScrollComponent.



7
8
9
10
11
# File 'app/components/nquery/infinite_scroll_component.rb', line 7

def initialize(url:, target: "items", class: nil)
  @url = url
  @target = target
  @html_class = binding.local_variable_get(:class)
end

Instance Attribute Details

#html_classObject (readonly)

Returns the value of attribute html_class.



5
6
7
# File 'app/components/nquery/infinite_scroll_component.rb', line 5

def html_class
  @html_class
end

#targetObject (readonly)

Returns the value of attribute target.



5
6
7
# File 'app/components/nquery/infinite_scroll_component.rb', line 5

def target
  @target
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'app/components/nquery/infinite_scroll_component.rb', line 5

def url
  @url
end

Instance Method Details

#css_classObject



13
14
15
16
17
# File 'app/components/nquery/infinite_scroll_component.rb', line 13

def css_class
  classes = ["nq-infinite-scroll"]
  classes << html_class if html_class.present?
  classes.join(" ")
end