Class: HTMX::Headers::Response
- Inherits:
-
Data
- Object
- Data
- HTMX::Headers::Response
- Defined in:
- lib/htmx/headers/response.rb
Overview
Models the supported HTMX response headers.
Class Method Summary collapse
- .for(key_map: RESPONSE_MAP.invert, **attributes) ⇒ Object
- .header_for(key, key_map: RESPONSE_MAP) ⇒ Object
- .key_for(header, key_map: RESPONSE_MAP.invert) ⇒ Object
Instance Method Summary collapse
-
#initialize(location: nil, push_url: nil, redirect: nil, refresh: nil, replace_url: nil, reswap: nil, retarget: nil, trigger: nil, trigger_after_settle: nil, trigger_after_swap: nil) ⇒ Response
constructor
A new instance of Response.
- #refresh? ⇒ Boolean
Constructor Details
#initialize(location: nil, push_url: nil, redirect: nil, refresh: nil, replace_url: nil, reswap: nil, retarget: nil, trigger: nil, trigger_after_settle: nil, trigger_after_swap: nil) ⇒ Response
Returns a new instance of Response.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/htmx/headers/response.rb', line 15 def initialize location: nil, push_url: nil, redirect: nil, refresh: nil, replace_url: nil, reswap: nil, retarget: nil, trigger: nil, trigger_after_settle: nil, trigger_after_swap: nil super end |
Class Method Details
.for(key_map: RESPONSE_MAP.invert, **attributes) ⇒ Object
7 8 9 |
# File 'lib/htmx/headers/response.rb', line 7 def self.for(key_map: RESPONSE_MAP.invert, **attributes) new(**attributes.slice(*key_map.keys).transform_keys!(key_map)) end |
.header_for(key, key_map: RESPONSE_MAP) ⇒ Object
13 |
# File 'lib/htmx/headers/response.rb', line 13 def self.header_for(key, key_map: RESPONSE_MAP) = key_map.fetch key |
.key_for(header, key_map: RESPONSE_MAP.invert) ⇒ Object
11 |
# File 'lib/htmx/headers/response.rb', line 11 def self.key_for(header, key_map: RESPONSE_MAP.invert) = key_map.fetch header |
Instance Method Details
#refresh? ⇒ Boolean
28 |
# File 'lib/htmx/headers/response.rb', line 28 def refresh? = refresh == "true" |