Class: PRRD::Graph::Color

Inherits:
Entity
  • Object
show all
Defined in:
lib/prrd/graph/colors.rb

Overview

PRRD Graph Color class

Instance Attribute Summary

Attributes inherited from Entity

#data, #keys

Instance Method Summary collapse

Methods inherited from Entity

#method_missing, #validate_presence

Constructor Details

#initialize(values = nil) ⇒ Color

Constructor



11
12
13
14
15
16
17
18
# File 'lib/prrd/graph/colors.rb', line 11

def initialize(values = nil)
  @keys = [
    :colortag,
    :color
  ]

  super values
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PRRD::Entity

Instance Method Details

#to_sObject

Transform to a COLOR formatted string



21
22
23
24
25
# File 'lib/prrd/graph/colors.rb', line 21

def to_s
  fail 'Empty color object' if @data.empty?

  "--color %s%s " % [@data[:colortag], @data[:color]]
end