Class: Ecoportal::API::V2::Page::Component::GaugeStop

Inherits:
Common::Content::DoubleModel show all
Defined in:
lib/ecoportal/api/v2/page/component/gauge_stop.rb

Constant Summary

Constants included from Common::Content::DoubleModel::Diffable

Common::Content::DoubleModel::Diffable::DIFF_CLASS

Constants included from Common::Content::DoubleModel::Base

Common::Content::DoubleModel::Base::NOT_USED

Instance Attribute Summary

Attributes included from Common::Content::DoubleModel::Parented

#_parent, #_parent_key

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Common::Content::DoubleModel

#initialize, new_uuid

Methods included from Common::Content::DoubleModel::Diffable

#as_update, #dirty?

Methods included from Common::Content::Includer

#include_missing

Constructor Details

This class inherits a constructor from Ecoportal::API::Common::Content::DoubleModel

Class Method Details

.new_docObject



8
9
10
11
12
13
14
# File 'lib/ecoportal/api/v2/page/component/gauge_stop.rb', line 8

def new_doc
  {
    'id'        => new_uuid,
    'threshold' => nil,
    'color'     => nil
  }
end

Instance Method Details

#color=(value) ⇒ Object

Note:

These are the available colors:

  • :blue, :blue_greyed, :blue_light
  • :turquoise, :jade, :green, :pistachio, :avocado
  • :yellow, :orange, :pumpkin, :red, :magenta, :fuchsia, :purple, :violet

Assign the color to the stop.

Parameters:

  • value (String, Symbol)

    you can use a symbol to specify a color



27
28
29
30
# File 'lib/ecoportal/api/v2/page/component/gauge_stop.rb', line 27

def color=(value)
  value = to_color(value) if value.is_a?(Symbol)
  doc['color'] = value
end

#color_symSymbol

Returns to get the color sym code.

Returns:

  • (Symbol)

    to get the color sym code



33
34
35
36
37
38
39
# File 'lib/ecoportal/api/v2/page/component/gauge_stop.rb', line 33

def color_sym
  color_maps.each do |k, v|
    return k if color == v
  end

  :undefined
end