Sha256: 6934beba8cb80997e14af1d66045553d96b5e0a6c46fc0c577caea90aa5f8daa

Contents?: true

Size: 924 Bytes

Versions: 6

Compression:

Stored size: 924 Bytes

Contents

module Checked
  
  module DSL
    
    class Obj < BasicObject
      
      attr_reader :prefix, :headers
      def initialize prefix, name, val
        @prefix      = prefix
        @headers     = { 'check_name' => name, 'check_target' => val }
        @max_missing = 4
        @miss_count  = 0
      end
      
      def method_missing name, *args, &blok
        if @miss_count >= @max_missing
          ::Kernel.raise "Infinite loop: #{name}, #{args}"
        end
        
        @miss_count = @miss_count + 1
        ::Kernel.raise "No block allowed." if blok
        headers['args'] = args
        
        path = '/' + [ @prefix, name ].map(&:to_s).join('/') + '/'
        app = ::Checked::Arch.new( path, headers ) 
        app.fulfill_request
        app.request.response.body
      end # === def method_missing
      
    end # === class Obj < BasicObject
    
  end # === module DSL
  
end # === module Checked

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
Checked-1.2.3 lib/Checked/Base/DSL_Obj.rb
Checked-1.2.2 lib/Checked/Base/DSL_Obj.rb
Checked-1.2.1 lib/Checked/Base/DSL_Obj.rb
Checked-1.2.0 lib/Checked/Base/DSL_Obj.rb
Checked-1.1.0 lib/Checked/Base/DSL_Obj.rb
Checked-1.0.0 lib/Checked/Base/DSL_Obj.rb