Class: Verdict::Group

Inherits:
Object
  • Object
show all
Includes:
Metadata
Defined in:
lib/verdict/group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Metadata

#description, included, #name, #owner, #screenshot

Constructor Details

#initialize(experiment, handle) ⇒ Group

Returns a new instance of Group.



6
7
8
# File 'lib/verdict/group.rb', line 6

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

Instance Attribute Details

#experimentObject (readonly)

Returns the value of attribute experiment.



4
5
6
# File 'lib/verdict/group.rb', line 4

def experiment
  @experiment
end

#handleObject (readonly)

Returns the value of attribute handle.



4
5
6
# File 'lib/verdict/group.rb', line 4

def handle
  @handle
end

Instance Method Details

#===(other) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/verdict/group.rb', line 18

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

#as_json(options = {}) ⇒ Object



26
27
28
29
30
31
# File 'lib/verdict/group.rb', line 26

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

#to_json(options = {}) ⇒ Object



33
34
35
# File 'lib/verdict/group.rb', line 33

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

#to_sObject



10
11
12
# File 'lib/verdict/group.rb', line 10

def to_s
  handle
end

#to_symObject



14
15
16
# File 'lib/verdict/group.rb', line 14

def to_sym
  handle.to_sym
end