Class: RSAC::Function
- Inherits:
-
LexicalUnit
- Object
- LexicalUnit
- RSAC::Function
- Defined in:
- lib/antisamy/csspool/rsac/sac/lexical_unit.rb
Constant Summary collapse
- FUNCTIONS =
{ 'counter' => :SAC_COUNTER_FUNCTION, 'counters' => :SAC_COUNTERS_FUNCTION, 'rect' => :SAC_RECT_FUNCTION, }
Instance Attribute Summary
Attributes inherited from LexicalUnit
#dimension_unit_text, #float_value, #function_name, #integer_value, #lexical_unit_type, #parameters, #string_value
Instance Method Summary collapse
- #==(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(name, params) ⇒ Function
constructor
A new instance of Function.
Methods inherited from LexicalUnit
Constructor Details
#initialize(name, params) ⇒ Function
Returns a new instance of Function.
28 29 30 31 32 33 34 |
# File 'lib/antisamy/csspool/rsac/sac/lexical_unit.rb', line 28 def initialize(name, params) self.string_value = "#{name}#{params.join(', ')})" name =~ /^(.*)\(/ self.function_name = $1 self.parameters = params self.lexical_unit_type = FUNCTIONS[self.function_name] || :SAC_FUNCTION end |
Instance Method Details
#==(other) ⇒ Object
36 37 38 39 40 |
# File 'lib/antisamy/csspool/rsac/sac/lexical_unit.rb', line 36 def ==(other) super && %w{ function_name parameters }.all? { |x| self.send(x.to_sym) == other.send(x.to_sym) } end |
#hash ⇒ Object
42 43 44 |
# File 'lib/antisamy/csspool/rsac/sac/lexical_unit.rb', line 42 def hash ([self.function_name] + parameters).hash end |