class ConditionalMessages::ReadCategory

Attributes

category[R]

Public Class Methods

new(category) click to toggle source
# File lib/conditional_messages/read_category.rb, line 12
def initialize(category)
  @category = category
end

Public Instance Methods

for(context) click to toggle source
# File lib/conditional_messages/read_category.rb, line 20
def for(context)
  context_holder = ContextHolder.new(context)
  applied_message = FindMessage.for(context_holder, category)
  ReadMessage.new(context, applied_message, renderer.new)
end
name() click to toggle source
# File lib/conditional_messages/read_category.rb, line 16
def name
  category.name
end
renderer() click to toggle source
# File lib/conditional_messages/read_category.rb, line 26
def renderer
  if defined?(Redcarpet) && defined?(Nokogiri)
    HTMLRenderer
  else
    TextRenderer
  end
end