Module: SimpleDecorator::Header::ClassMethods
- Defined in:
- lib/simple_decorator/header.rb
Instance Method Summary collapse
- #attr_header(*attributes) ⇒ Object
- #headers? ⇒ Boolean
- #link?(field) ⇒ Boolean
- #list_action?(action) ⇒ Boolean
- #list_actions? ⇒ Boolean
- #set(params) ⇒ Object
Instance Method Details
#attr_header(*attributes) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/simple_decorator/header.rb', line 13 def attr_header(*attributes) = attributes. self.header_attributes = set attributes self.header_link_attributes = set .fetch(:link, attributes.first) self.header_actions = set [:list_actions] self.link_path = .fetch(:link_path, :edit_resource_path) end |
#headers? ⇒ Boolean
30 31 32 |
# File 'lib/simple_decorator/header.rb', line 30 def headers? header_attributes.present? end |
#link?(field) ⇒ Boolean
22 23 24 |
# File 'lib/simple_decorator/header.rb', line 22 def link?(field) headers? && header_link_attributes.include?(field) end |
#list_action?(action) ⇒ Boolean
26 27 28 |
# File 'lib/simple_decorator/header.rb', line 26 def list_action?(action) list_actions? && header_actions.include?(action) end |
#list_actions? ⇒ Boolean
34 35 36 |
# File 'lib/simple_decorator/header.rb', line 34 def list_actions? header_actions.present? end |
#set(params) ⇒ Object
38 39 40 |
# File 'lib/simple_decorator/header.rb', line 38 def set(params) Set.new Array(params).map(&:to_sym) end |