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.
- #scroll(options = {}, &block) ⇒ Object
- #separator(string = ' | ', &block) ⇒ Object (also: #static)
Constructor Details
#initialize(container) ⇒ DSL
Returns a new instance of DSL.
7 8 9 |
# File 'lib/conquer/dsl.rb', line 7 def initialize(container) @container = container end |
Instance Method Details
#block(&block) ⇒ Object
29 30 31 |
# File 'lib/conquer/dsl.rb', line 29 def block(&block) every(0, &block) end |
#every(timespan, &block) ⇒ Object
25 26 27 |
# File 'lib/conquer/dsl.rb', line 25 def every(timespan, &block) @container.register(Segment, timespan, block) end |
#helpers(&block) ⇒ Object
11 12 13 |
# File 'lib/conquer/dsl.rb', line 11 def helpers(&block) Helpers.singleton_class.class_eval(&block) end |
#scroll(options = {}, &block) ⇒ Object
33 34 35 36 37 |
# File 'lib/conquer/dsl.rb', line 33 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
15 16 17 18 19 20 21 |
# File 'lib/conquer/dsl.rb', line 15 def separator(string = ' | ', &block) if block_given? every(100.hours, &block) else every(100.hours) { string } end end |