Class: Conquer::DSL
- Inherits:
-
Object
- Object
- Conquer::DSL
- Defined in:
- lib/conquer/dsl.rb
Instance Method Summary collapse
- #block(&block) ⇒ Object
- #every(timespan, &block) ⇒ Object
- #helpers(&block) ⇒ Object
-
#initialize(container) ⇒ DSL
constructor
A new instance of DSL.
- #on(*events, &block) ⇒ Object
- #scroll(options = {}, &block) ⇒ Object
- #separator(string = ' | ', &block) ⇒ Object (also: #static)
Constructor Details
#initialize(container) ⇒ DSL
Returns a new instance of DSL.
8 9 10 |
# File 'lib/conquer/dsl.rb', line 8 def initialize(container) @container = container end |
Instance Method Details
#block(&block) ⇒ Object
30 31 32 |
# File 'lib/conquer/dsl.rb', line 30 def block(&block) every(0, &block) end |
#every(timespan, &block) ⇒ Object
26 27 28 |
# File 'lib/conquer/dsl.rb', line 26 def every(timespan, &block) @container.register(Segment, timespan, block) end |
#helpers(&block) ⇒ Object
12 13 14 |
# File 'lib/conquer/dsl.rb', line 12 def helpers(&block) Helpers.singleton_class.class_eval(&block) end |
#on(*events, &block) ⇒ Object
34 35 36 |
# File 'lib/conquer/dsl.rb', line 34 def on(*events, &block) @container.register(EventSegment, block, *events) end |
#scroll(options = {}, &block) ⇒ Object
38 39 40 41 42 |
# File 'lib/conquer/dsl.rb', line 38 def scroll( = {}, &block) scroller = @container.register(Scroller, ) sub_dsl = DSL.new(scroller) sub_dsl.instance_eval(&block) end |
#separator(string = ' | ', &block) ⇒ Object Also known as: static
16 17 18 19 20 21 22 |
# File 'lib/conquer/dsl.rb', line 16 def separator(string = ' | ', &block) if block_given? every(100.hours, &block) else every(100.hours) { string } end end |