Class: AntiSamy::CssProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/antisamy/model/css_property.rb

Overview

A model for CSS properties and the “rules” they must follow (either literals or regular expressions) in order to be considered valid.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ CssProperty

Create a new property



8
9
10
11
12
13
14
15
16
# File 'lib/antisamy/model/css_property.rb', line 8

def initialize(name)
  @name = name
  @description = nil
  @values = []
  @expressions = []
  @refs = []
  @categories = []
  @action = nil
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



5
6
7
# File 'lib/antisamy/model/css_property.rb', line 5

def action
  @action
end

#catagoriesObject

Returns the value of attribute catagories.



5
6
7
# File 'lib/antisamy/model/css_property.rb', line 5

def catagories
  @catagories
end

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/antisamy/model/css_property.rb', line 5

def description
  @description
end

#expressionsObject

Returns the value of attribute expressions.



5
6
7
# File 'lib/antisamy/model/css_property.rb', line 5

def expressions
  @expressions
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/antisamy/model/css_property.rb', line 5

def name
  @name
end

#refsObject

Returns the value of attribute refs.



5
6
7
# File 'lib/antisamy/model/css_property.rb', line 5

def refs
  @refs
end

#valuesObject

Returns the value of attribute values.



5
6
7
# File 'lib/antisamy/model/css_property.rb', line 5

def values
  @values
end

Instance Method Details

#add_category(cat) ⇒ Object

Add a category to this property



34
35
36
# File 'lib/antisamy/model/css_property.rb', line 34

def add_category(cat)
  @categories << cat
end

#add_expression(exp) ⇒ Object

Add a regular expression to this property



24
25
26
# File 'lib/antisamy/model/css_property.rb', line 24

def add_expression(exp)
  @expressions << exp
end

#add_ref(ref) ⇒ Object

Add a shorthand reference to this property



29
30
31
# File 'lib/antisamy/model/css_property.rb', line 29

def add_ref(ref)
  @refs << ref
end

#add_value(value) ⇒ Object

Add a literal value to this property



19
20
21
# File 'lib/antisamy/model/css_property.rb', line 19

def add_value(value)
  @values << value
end