Sha256: 7d5994b63fbf4d619741d2e1bd8b3367c1f49400b03893b561d7bb8cc96128c8

Contents?: true

Size: 978 Bytes

Versions: 18

Compression:

Stored size: 978 Bytes

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'tempfile'
require 'ptools'
require 'sinatra/base'
require 'helpers/http_headers'

module Mirage
  class Server < Sinatra::Base
    module Helpers
      module TemplateRequirements
        def convert_raw_required_params raw_requirements
          raw_requirements.collect { |requirement| requirement.split(":") }.inject({}) do |hash, pair|
            parameter, value = pair.collect { |string| string.strip }
            value = convert_value(value)
            hash[parameter] =value; hash
          end
        end

        def convert_raw_required_body_content_requirements raw_requirements
          raw_requirements.collect do |string|
            string.start_with?("%r{") && string.end_with?("}") ? eval(string) : string
          end
        end


        private
        def convert_value(value)
          value.start_with?("%r{") && value.end_with?("}") ? eval(value) : value
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
mirage-4.0.0.alpha10 server/helpers/template_requirements.rb
mirage-4.0.0.alpha9 server/helpers/template_requirements.rb
mirage-4.0.0.alpha8 server/helpers/template_requirements.rb
mirage-4.0.0.alpha6 server/helpers/template_requirements.rb
mirage-4.0.0.alpha5 server/helpers/template_requirements.rb
mirage-4.0.0.alpha4 server/helpers/template_requirements.rb
mirage-4.0.0.alpha3 server/helpers/template_requirements.rb
mirage-4.0.0.alpha2 server/helpers/template_requirements.rb
mirage-4.0.0.alpha1 server/helpers/template_requirements.rb
mirage-3.0.14 server/helpers/template_requirements.rb
mirage-3.0.13 server/helpers/template_requirements.rb
mirage-3.0.12 server/helpers/template_requirements.rb
mirage-3.0.11 server/helpers/template_requirements.rb
mirage-3.0.10 server/helpers/template_requirements.rb
mirage-3.0.9 server/helpers/template_requirements.rb
mirage-on-thin-3.0.8 server/helpers/template_requirements.rb
mirage-3.0.8 server/helpers/template_requirements.rb
mirage-3.0.7 server/helpers/template_requirements.rb