Class: ConditionalMessages::ReadCategory
- Inherits:
-
Object
- Object
- ConditionalMessages::ReadCategory
- Defined in:
- lib/conditional_messages/read_category.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
Instance Method Summary collapse
- #for(context) ⇒ Object
-
#initialize(category) ⇒ ReadCategory
constructor
A new instance of ReadCategory.
- #name ⇒ Object
- #renderer ⇒ Object
Constructor Details
#initialize(category) ⇒ ReadCategory
Returns a new instance of ReadCategory.
12 13 14 |
# File 'lib/conditional_messages/read_category.rb', line 12 def initialize(category) @category = category end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
10 11 12 |
# File 'lib/conditional_messages/read_category.rb', line 10 def category @category end |
Instance Method Details
#for(context) ⇒ Object
20 21 22 23 24 |
# File 'lib/conditional_messages/read_category.rb', line 20 def for(context) context_holder = ContextHolder.new(context) = FindMessage.for(context_holder, category) ReadMessage.new(context, , renderer.new) end |
#name ⇒ Object
16 17 18 |
# File 'lib/conditional_messages/read_category.rb', line 16 def name category.name end |
#renderer ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/conditional_messages/read_category.rb', line 26 def renderer if defined?(Redcarpet) && defined?(Nokogiri) HTMLRenderer else TextRenderer end end |