Class: XRay::CSS::Directive
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#expression ⇒ Object
readonly
Returns the value of attribute expression.
-
#keyword ⇒ Object
readonly
Returns the value of attribute keyword.
Instance Method Summary collapse
-
#initialize(keyword, expression, block = nil) ⇒ Directive
constructor
A new instance of Directive.
- #position ⇒ Object
- #text ⇒ Object
Constructor Details
#initialize(keyword, expression, block = nil) ⇒ Directive
Returns a new instance of Directive.
36 37 38 |
# File 'lib/css/struct.rb', line 36 def initialize(keyword, expression, block = nil) @keyword, @expression, @block = keyword, expression, block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
34 35 36 |
# File 'lib/css/struct.rb', line 34 def block @block end |
#expression ⇒ Object (readonly)
Returns the value of attribute expression.
34 35 36 |
# File 'lib/css/struct.rb', line 34 def expression @expression end |
#keyword ⇒ Object (readonly)
Returns the value of attribute keyword.
34 35 36 |
# File 'lib/css/struct.rb', line 34 def keyword @keyword end |
Instance Method Details
#position ⇒ Object
53 54 55 |
# File 'lib/css/struct.rb', line 53 def position keyword.position end |
#text ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/css/struct.rb', line 40 def text t = "@#{keyword}" if expression t += "#{expression}" end if block t += "{\n#{block}\n}\n" else t += ';' end t end |