Class: Screenomat::DSL::Screen
- Inherits:
-
Object
- Object
- Screenomat::DSL::Screen
- Defined in:
- lib/screenomat/dsl/screen.rb
Instance Attribute Summary collapse
-
#screen_id ⇒ Object
Returns the value of attribute screen_id.
Instance Method Summary collapse
-
#initialize(*options) ⇒ Screen
constructor
A new instance of Screen.
- #screen ⇒ Object
- #stuff ⇒ Object
Constructor Details
#initialize(*options) ⇒ Screen
Returns a new instance of Screen.
6 7 8 9 10 11 12 13 |
# File 'lib/screenomat/dsl/screen.rb', line 6 def initialize(*) @options = @screen_id = nil if @options.first.kind_of?(::Fixnum) @screen_id = @options.shift end end |
Instance Attribute Details
#screen_id ⇒ Object
Returns the value of attribute screen_id.
4 5 6 |
# File 'lib/screenomat/dsl/screen.rb', line 4 def screen_id @screen_id end |
Instance Method Details
#screen ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/screenomat/dsl/screen.rb', line 25 def screen title = nil if @options.last.kind_of?(::Hash) opts = @options.last title = opts[:title] end if @screen_id == 0 output = [] output << %{-p 0 title "#{title}"} if title else output = %w{screen} output << %{-t "#{title}"} if title output << (@screen_id || 0) end output * ' ' end |
#stuff ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/screenomat/dsl/screen.rb', line 15 def stuff output = [ %{-p #{@screen_id || 0} stuff} ] if @options.first.kind_of?(::String) output << %{"#{@options.first}\n"} end output * ' ' end |