Class: Bracken::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/bracken/application.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApplication

Returns a new instance of Application.



9
10
11
# File 'lib/bracken/application.rb', line 9

def initialize
  @configuration = Configuration.new
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



7
8
9
# File 'lib/bracken/application.rb', line 7

def configuration
  @configuration
end

Class Method Details

.execute(arguments) ⇒ Object



3
4
5
# File 'lib/bracken/application.rb', line 3

def self.execute(arguments)
  new.execute(arguments)
end

Instance Method Details

#execute(arguments) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/bracken/application.rb', line 13

def execute(arguments)
  configuration.parse(arguments)

  while activity = IO.select(configuration.streams)
    streams = activity.first

    streams.each do |stream|
      line = stream.filtered_gets

      if line
        STDOUT.puts line
        STDOUT.flush
      end
    end
  end
end