Sha256: 28ba932665d36fc59ba52c12ba150ea731c4f03d12648e88924e589de5b29c12

Contents?: true

Size: 638 Bytes

Versions: 16

Compression:

Stored size: 638 Bytes

Contents

module Hoth
  class Endpoint
    attr_accessor :host, :port, :module_name, :transport
    
    class ConfigEvaluator
      attr_reader :endpoint
      def initialize(endpoint, &block)
        @endpoint = endpoint
        instance_eval(&block)
      end
      
      [:host, :port, :module_name, :transport].each do |endpoint_attribute|
        define_method endpoint_attribute do |value|
          endpoint.send("#{endpoint_attribute}=", value)
        end
      end
    end
    
    def initialize(&block)
      ConfigEvaluator.new(self, &block)
    end
    
    def to_url
      "http://#{@host}:#{@port}/execute"
    end
    
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
hoth-0.4.2 lib/hoth/endpoint.rb
hoth-0.4.1 lib/hoth/endpoint.rb
hoth-0.4.0 lib/hoth/endpoint.rb
hoth-0.3.4 lib/hoth/endpoint.rb
hoth-0.3.3 lib/hoth/endpoint.rb
hoth-0.3.2.beta4 lib/hoth/endpoint.rb
hoth-0.3.2.beta3 lib/hoth/endpoint.rb
hoth-0.3.2.beta2 lib/hoth/endpoint.rb
hoth-0.3.2.beta1 lib/hoth/endpoint.rb
hoth-0.3.1 lib/hoth/endpoint.rb
sk-hoth-0.3.5 lib/hoth/endpoint.rb
sk-hoth-0.3.4 lib/hoth/endpoint.rb
sk-hoth-0.3.2 lib/hoth/endpoint.rb
sk-hoth-0.3.1 lib/hoth/endpoint.rb
sk-hoth-0.3.0 lib/hoth/endpoint.rb
hoth-0.3.0 lib/hoth/endpoint.rb