Class: RSAC::Conditions::IDCondition

Inherits:
AttributeCondition show all
Defined in:
lib/antisamy/csspool/rsac/sac/conditions/id_condition.rb

Instance Attribute Summary

Attributes inherited from AttributeCondition

#local_name, #specified, #value

Attributes inherited from Condition

#condition_type

Instance Method Summary collapse

Methods inherited from AttributeCondition

#==, build, #hash

Methods inherited from Condition

#==, #eql?, #hash

Constructor Details

#initialize(id) ⇒ IDCondition

Returns a new instance of IDCondition.



5
6
7
8
# File 'lib/antisamy/csspool/rsac/sac/conditions/id_condition.rb', line 5

def initialize(id)
  id = id[1..id.size] if id[0] == ?#
  super("id", id, true, :SAC_ID_CONDITION)
end

Instance Method Details

#specificityObject



18
19
20
# File 'lib/antisamy/csspool/rsac/sac/conditions/id_condition.rb', line 18

def specificity
  [0, 1, 0, 0]
end

#to_cssObject



10
11
12
# File 'lib/antisamy/csspool/rsac/sac/conditions/id_condition.rb', line 10

def to_css
  "##{value}"
end

#to_xpathObject



14
15
16
# File 'lib/antisamy/csspool/rsac/sac/conditions/id_condition.rb', line 14

def to_xpath
  "[@id='#{value}']"
end