Sha256: 6cbed4f2f439692b7d2d45f650e51bb4d627c8bf0bcae07e45cdfab5638e2b9c

Contents?: true

Size: 605 Bytes

Versions: 27

Compression:

Stored size: 605 Bytes

Contents

class Verdict::Group
  include Verdict::Metadata

  attr_reader :experiment, :handle

  def initialize(experiment, handle)
    @experiment, @handle = experiment, handle.to_s
  end

  def to_s
    handle
  end

  def to_sym
    handle.to_sym
  end

  def ===(other)
    case other
      when Verdict::Group; experiment == other.experiment && other.handle == handle
      when Symbol, String; handle == other.to_s
      else false
    end
  end

  def as_json(options = {})
    {
      handle: handle,
      metadata: metadata
    }
  end

  def to_json(options = {})
    as_json(options).to_json
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
verdict-0.3.2 lib/verdict/group.rb
verdict-0.3.1 lib/verdict/group.rb
verdict-0.3.0 lib/verdict/group.rb
verdict-0.2.1 lib/verdict/group.rb
verdict-0.2.0 lib/verdict/group.rb
verdict-0.1.1 lib/verdict/group.rb
verdict-0.1.0 lib/verdict/group.rb