Sha256: 88baf3158973ff70f072b1c41efbbeffabc5323207d61d0ba63004536c5c3bd4

Contents?: true

Size: 872 Bytes

Versions: 5

Compression:

Stored size: 872 Bytes

Contents

module Scide

  class Window
    
    def initialize contents, project
      @project = project
      if contents.kind_of? Hash
        init_from_hash contents
      elsif contents.kind_of? String
        init_from_string contents
      end
    end

    def to_screen index
      String.new.tap do |s|
        s << "screen -t #{@name} #{index}\n"
        s << @command.to_screen if @command
      end
    end

    private

    def init_from_hash contents
      @name = contents.delete :name
      @command = Command.resolve contents, @project.properties, @project.options if contents.key? :command
    end

    def init_from_string contents
      content_parts = contents.split /\s+/, 2
      @name = content_parts[0]
      if content_parts.length == 2
        @command = Command.resolve content_parts[1], @project.properties, @project.options
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scide-0.0.5 lib/scide/window.rb
scide-0.0.4 lib/scide/window.rb
scide-0.0.3 lib/scide/window.rb
scide-0.0.2 lib/scide/window.rb
scide-0.0.1 lib/scide/window.rb