Class: PublishingPlatformPublishingComponents::Presenters::SharedHelper
- Inherits:
-
Object
- Object
- PublishingPlatformPublishingComponents::Presenters::SharedHelper
- Defined in:
- lib/publishing_platform_publishing_components/presenters/shared_helper.rb
Instance Attribute Summary collapse
-
#classes ⇒ Object
readonly
Returns the value of attribute classes.
-
#heading_level ⇒ Object
readonly
Returns the value of attribute heading_level.
-
#margin_bottom ⇒ Object
readonly
Returns the value of attribute margin_bottom.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #get_heading_level ⇒ Object
- #get_heading_size ⇒ Object
-
#initialize(local_assigns) ⇒ SharedHelper
constructor
A new instance of SharedHelper.
Constructor Details
#initialize(local_assigns) ⇒ SharedHelper
Returns a new instance of SharedHelper.
6 7 8 9 10 11 |
# File 'lib/publishing_platform_publishing_components/presenters/shared_helper.rb', line 6 def initialize(local_assigns) = local_assigns @margin_bottom = [:margin_bottom] || 3 @heading_level = [:heading_level] || 2 @heading_size = [:heading_size] || 2 end |
Instance Attribute Details
#classes ⇒ Object (readonly)
Returns the value of attribute classes.
4 5 6 |
# File 'lib/publishing_platform_publishing_components/presenters/shared_helper.rb', line 4 def classes @classes end |
#heading_level ⇒ Object (readonly)
Returns the value of attribute heading_level.
4 5 6 |
# File 'lib/publishing_platform_publishing_components/presenters/shared_helper.rb', line 4 def heading_level @heading_level end |
#margin_bottom ⇒ Object (readonly)
Returns the value of attribute margin_bottom.
4 5 6 |
# File 'lib/publishing_platform_publishing_components/presenters/shared_helper.rb', line 4 def margin_bottom @margin_bottom end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/publishing_platform_publishing_components/presenters/shared_helper.rb', line 4 def end |
Instance Method Details
#get_heading_level ⇒ Object
13 14 15 16 17 |
# File 'lib/publishing_platform_publishing_components/presenters/shared_helper.rb', line 13 def get_heading_level return [*1..6].include?(@heading_level) ? "h#{@heading_level}" : "h2" unless @heading_level.zero? "span" end |
#get_heading_size ⇒ Object
19 20 21 |
# File 'lib/publishing_platform_publishing_components/presenters/shared_helper.rb', line 19 def get_heading_size [*1..6].include?(@heading_size) ? "h#{@heading_size}" : "h2" end |