Sha256: 6641c673bb3a68fd64596d56051d369bf5ad599db78284f0f9e55919bf681d20

Contents?: true

Size: 1016 Bytes

Versions: 6

Compression:

Stored size: 1016 Bytes

Contents

# explicit request types
module Wunderbar
  module Options
    XHR_JSON  = ARGV.delete('--json')
    TEXT      = ARGV.delete('--text')
  end

  module Untaint
    def untaint_if_match regexp
      self.untaint if regexp.match(self)
    end
  end

  class Scope
    attr_accessor :env
    def initialize(env)
      @env = env
    end
  end
end

require 'socket'
$SERVER = ENV['HTTP_HOST'] || Socket::gethostname

# set encoding to UTF-8
ENV['LANG'] ||= "en_US.UTF-8"
if defined? Encoding
  Encoding.default_external = Encoding::UTF_8
  Encoding.default_internal = Encoding::UTF_8
else
  $KCODE = 'U'
end

# Add methods to the 'main' object
if self.to_s == 'main'
  class << self
    def _html(*args, &block)
      Wunderbar.html(*args, &block)
    end

    def _xhtml(*args, &block)
      Wunderbar.xhtml(*args, &block)
    end

    def _json(*args, &block)
      Wunderbar.json(*args, &block)
    end

    def _text(*args, &block)
      Wunderbar.text(*args, &block)
    end

    def env
      ENV
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wunderbar-0.10.9 lib/wunderbar/environment.rb
wunderbar-0.10.8 lib/wunderbar/environment.rb
wunderbar-0.10.7 lib/wunderbar/environment.rb
wunderbar-0.10.6 lib/wunderbar/environment.rb
wunderbar-0.10.5 lib/wunderbar/environment.rb
wunderbar-0.10.4 lib/wunderbar/environment.rb