Class: Nquery::InfiniteScrollComponent
- Defined in:
- app/components/nquery/infinite_scroll_component.rb
Instance Attribute Summary collapse
-
#html_class ⇒ Object
readonly
Returns the value of attribute html_class.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #css_class ⇒ Object
-
#initialize(url:, target: "items", class: nil) ⇒ InfiniteScrollComponent
constructor
A new instance of InfiniteScrollComponent.
Methods inherited from Component
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_class ⇒ Object (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 |
#target ⇒ Object (readonly)
Returns the value of attribute target.
5 6 7 |
# File 'app/components/nquery/infinite_scroll_component.rb', line 5 def target @target end |
#url ⇒ Object (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_class ⇒ Object
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 |