Class: Element::Styles

Inherits:
Object show all
Defined in:
lib/source/redshift/accessors.rb

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ Styles

:nodoc:



500
501
502
# File 'lib/source/redshift/accessors.rb', line 500

def initialize(element) # :nodoc:
  @element = element
end

Instance Method Details

#[](attribute) ⇒ Object

call-seq:

styles[sym] -> object

Returns the value of the CSS style sym for the element represented by styles, or nil if no such style is applied. See also Element#get_style.



513
514
515
# File 'lib/source/redshift/accessors.rb', line 513

def [](attribute)
  `c$Element.prototype.m$get_style.call(#{@element},attribute)`
end

#[]=(attribute, value) ⇒ Object

call-seq:

styles[sym] = value -> value

Sets the value of the CSS style sym to value for the element represented by styles. See also Element#set_style.



525
526
527
# File 'lib/source/redshift/accessors.rb', line 525

def []=(attribute, value)
  `c$Element.prototype.m$set_style.call(#{@element},attribute,value)`
end

#clearObject

call-seq:

styles.clear -> styles

Removes the CSS styles that have been applied to the element represented by styles. See also Element#clear_styles.



537
538
539
# File 'lib/source/redshift/accessors.rb', line 537

def clear
  `c$Element.prototype.m$clear_styles.call(#{@element})`
end

#delete(attribute) ⇒ Object

call-seq:

styles.delete(sym) -> object or nil

If the element represented by styles has the CSS style sym applied, removes the style and returns its value, otherwise returns nil. See also Element#remove_style.



550
551
552
# File 'lib/source/redshift/accessors.rb', line 550

def delete(attribute)
  `c$Element.prototype.m$remove_style.call(#{@element},attribute)`
end

#set?(attribute) ⇒ Boolean

call-seq:

styles.set?(sym) -> true or false

Returns true if the element represented by styles has the CSS style sym applied, false otherwise.

Returns:

  • (Boolean)


562
563
564
# File 'lib/source/redshift/accessors.rb', line 562

def set?(attribute)
  `$T(c$Element.prototype.m$get_style.call(#{@element},attribute))`
end

#update(hash) ⇒ Object

call-seq:

styles.update({key => value, ...}) -> styles

Sets the value of the CSS style key of the element represented by styles to value for each key-value pair, then returns styles. See also Element#set_styles.



575
576
577
578
# File 'lib/source/redshift/accessors.rb', line 575

def update(hash)
  `c$Element.prototype.m$set_styles.call(#{@element},hash)`
  return self
end