class DataSet::Label

Attributes

id[RW]
meta[RW]
name[RW]

Public Class Methods

new(name, id: nil, meta: {}) click to toggle source
# File lib/tukey/data_set/label.rb, line 9
def initialize(name, id: nil, meta: {})
  @name = name
  @id = id || name
  fail ArgumentError, 'DataSet::Label meta must be a Hash' unless meta.is_a?(Hash)
  @meta = OpenStruct.new(meta)
end

Public Instance Methods

==(other) click to toggle source

is used for comparison of two instances directly

# File lib/tukey/data_set/label.rb, line 17
def ==(other)
  other.id == id
end
deep_dup() click to toggle source
# File lib/tukey/data_set/label.rb, line 31
def deep_dup
  label = dup
  id = id.dup if id
  name = name.dup if name
  meta = meta.dup if meta
  label
end
eql?(other) click to toggle source

eql? and hash are both used for comparisons when you call `.uniq` on an array of labels.

# File lib/tukey/data_set/label.rb, line 23
def eql?(other)
  self == other
end
hash() click to toggle source
# File lib/tukey/data_set/label.rb, line 27
def hash
  id.hash
end