Class: Magick::FeatureVariant

Inherits:
Object
  • Object
show all
Defined in:
lib/magick/feature_variant.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value, weight: 0) ⇒ FeatureVariant

Returns a new instance of FeatureVariant.



7
8
9
10
11
# File 'lib/magick/feature_variant.rb', line 7

def initialize(name, value, weight: 0)
  @name = name.to_s
  @value = value
  @weight = weight.to_f
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/magick/feature_variant.rb', line 5

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/magick/feature_variant.rb', line 5

def value
  @value
end

#weightObject (readonly)

Returns the value of attribute weight.



5
6
7
# File 'lib/magick/feature_variant.rb', line 5

def weight
  @weight
end

Instance Method Details

#to_hObject



13
14
15
# File 'lib/magick/feature_variant.rb', line 13

def to_h
  { name: name, value: value, weight: weight }
end