Sha256: 13f558d150ff81467b957eaa6f36282e1b917a37d747c7f6746fc356c81aaee8

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

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

  @@unsafe = false

  def self.unsafe!(mode=true)
    @@unsafe=mode
  end

  def self.safe?
    not @@unsafe
  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.13.0 lib/wunderbar/environment.rb
wunderbar-0.12.3 lib/wunderbar/environment.rb
wunderbar-0.12.1 lib/wunderbar/environment.rb
wunderbar-0.12.0 lib/wunderbar/environment.rb
wunderbar-0.11.1 lib/wunderbar/environment.rb
wunderbar-0.11.0 lib/wunderbar/environment.rb