Module: Vedeu::Templating::Helpers
Overview
Provide helpers to be used with your Vedeu templates.
Instance Method Summary collapse
- #background(value, &block) ⇒ Vedeu::Views::Stream (also: #bg)
- #colour(attributes = {}, &block) ⇒ Vedeu::Views::Stream
- #define_stream(attributes = {}, &block) ⇒ Object private
- #encode(data) ⇒ String private
- #foreground(value, &block) ⇒ Vedeu::Views::Stream (also: #fg)
- #style(value, &block) ⇒ Vedeu::Views::Stream
-
#time_now ⇒ String
included
from View
Returns the current local time.
Instance Method Details
#background(value, &block) ⇒ Vedeu::Views::Stream Also known as: bg
15 16 17 |
# File 'lib/vedeu/templating/helpers.rb', line 15 def background(value, &block) define_stream(background: value, &block) end |
#colour(attributes = {}, &block) ⇒ Vedeu::Views::Stream
28 29 30 |
# File 'lib/vedeu/templating/helpers.rb', line 28 def colour(attributes = {}, &block) define_stream(attributes, &block) end |
#define_stream(attributes = {}, &block) ⇒ Object (private)
51 52 53 54 55 56 57 58 59 |
# File 'lib/vedeu/templating/helpers.rb', line 51 def define_stream(attributes = {}, &block) fail Vedeu::Error::RequiresBlock unless block_given? encode( Vedeu::Views::Stream.build( colour: Vedeu::Colours::Colour.new(attributes), style: Vedeu::Presentation::Style.new(attributes[:style]), value: block.call)) end |
#encode(data) ⇒ String (private)
63 64 65 |
# File 'lib/vedeu/templating/helpers.rb', line 63 def encode(data) Vedeu::Templating::Encoder.process(data) end |
#foreground(value, &block) ⇒ Vedeu::Views::Stream Also known as: fg
36 37 38 |
# File 'lib/vedeu/templating/helpers.rb', line 36 def foreground(value, &block) define_stream(foreground: value, &block) end |
#style(value, &block) ⇒ Vedeu::Views::Stream
44 45 46 |
# File 'lib/vedeu/templating/helpers.rb', line 44 def style(value, &block) define_stream(style: value, &block) end |
#time_now ⇒ String Originally defined in module View
Returns the current local time.