Module: Anypow

Defined in:
lib/anypow.rb,
lib/anypow/version.rb

Defined Under Namespace

Classes: App

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ruby_18?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/anypow.rb', line 5

def self.ruby_18?
  defined?(RUBY_VERSION) and RUBY_VERSION =~ /^1\.8\.\d+/
end

Instance Method Details

#is_pow?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/anypow.rb', line 24

def is_pow?
  self.class.to_s == "Nack::Builder"
end

#run(app) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/anypow.rb', line 9

def run(app)
  if is_pow?
    super(app) if app.class == Anypow::App
  else
    super(app) if app.class != Anypow::App
  end
end

#run_pow(command) ⇒ Object



17
18
19
20
21
22
# File 'lib/anypow.rb', line 17

def run_pow(command)
  require 'rack'
  use Rack::Chunked
  use Rack::ContentLength
  run Anypow::App.new(command) if is_pow?
end