Sha256: 11a59f106d607bee31ac9e17586b2c7549d80c09cfc7c7504ef5358c5c02c4bd

Contents?: true

Size: 908 Bytes

Versions: 1

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true

require 'net/http'
require "active_support/all"

require_relative "ray/version"
require_relative "ray/request"
require_relative "ray/payload_factory"
require_relative "ray/payloads/payload"
require_relative "ray/payloads/bool_payload"
require_relative "ray/payloads/int_payload"
require_relative "ray/payloads/null_payload"
require_relative "ray/payloads/string_payload"

module Ray
  mattr_accessor :settings
  @@settings = { host: "http://localhost", port: 23517 }

  class Ray
    attr_reader :settings

    class Error < StandardError; end
    # Your code goes here...

    def initialize(settings)
      @settings = settings
    end

    def send(args)
      send_request PayloadFactory.create_for_values(args)
    end

    def send_request(payloads)
      Request.new(payloads, settings).send
    end
  end
end

def ray(*args)
  Ray::Ray.new(Ray.settings).send(args)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-ray-0.1.0 lib/ray.rb