Class: Doohickey::SassExtensions::Gradients::ColorStop

Inherits:
Sass::Script::Literal
  • Object
show all
Defined in:
lib/doohickey/sass_extensions/gradients.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(color, stop = nil) ⇒ ColorStop

Returns a new instance of ColorStop.



27
28
29
# File 'lib/doohickey/sass_extensions/gradients.rb', line 27

def initialize(color, stop = nil)
  self.color, self.stop = color, stop
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



26
27
28
# File 'lib/doohickey/sass_extensions/gradients.rb', line 26

def color
  @color
end

#stopObject

Returns the value of attribute stop.



26
27
28
# File 'lib/doohickey/sass_extensions/gradients.rb', line 26

def stop
  @stop
end

Instance Method Details

#inspectObject



30
31
32
# File 'lib/doohickey/sass_extensions/gradients.rb', line 30

def inspect
  to_s
end

#to_sObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/doohickey/sass_extensions/gradients.rb', line 33

def to_s
  s = color.inspect.dup
  if stop
    s << " "
    if stop.unitless?
      s << stop.times(Sass::Script::Number.new(100, ["%"])).inspect
    else
      s << stop.inspect
    end
  end
  s
end