Class: Theme::Presenters::ThemePresenter

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/project_types/theme/presenters/theme_presenter.rb

Constant Summary collapse

COLOR_BY_ROLE =
{
  "live" => "green",
  "unpublished" => "yellow",
  "development" => "blue",
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(theme) ⇒ ThemePresenter

Returns a new instance of ThemePresenter.



20
21
22
# File 'lib/project_types/theme/presenters/theme_presenter.rb', line 20

def initialize(theme)
  @theme = theme
end

Instance Attribute Details

#themeObject (readonly)

Returns the value of attribute theme.



16
17
18
# File 'lib/project_types/theme/presenters/theme_presenter.rb', line 16

def theme
  @theme
end

Instance Method Details

#to_s(mode = :long) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/project_types/theme/presenters/theme_presenter.rb', line 24

def to_s(mode = :long)
  case mode
  when :short
    "{{bold:#{name} #{theme_tags}}}"
  when :long
    "{{green:##{id}}} {{bold:#{name} #{theme_tags}}}"
  else
    inspect
  end
end