Class: Plate::AttributeNode
- Inherits:
-
Struct
- Object
- Struct
- Plate::AttributeNode
- Defined in:
- lib/plate/nodes.rb,
lib/plate/compiler.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value
17 18 19 |
# File 'lib/plate/nodes.rb', line 17 def value @value end |
Instance Method Details
#compile(compiler, parent = nil) ⇒ Object
100 101 102 |
# File 'lib/plate/compiler.rb', line 100 def compile(compiler, parent = nil) compile_value end |
#compile_value ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/plate/compiler.rb', line 79 def compile_value case value when 'blank' 'target="_blank"' when /\Abtn/ c = 'class="btn btn-default' c << ' btn-lg' if value =~ /\-lg/ c << ' btn-sm' if value =~ /\-sm/ c << ' btn-block' if value =~ /\-block/ c + '"' when /spin(\-\d+\.*\d*)?/ s = value.gsub(/spin\-?/, '') s = 1.5 if s.empty? "style=\"animation: spin #{s}s linear infinite\"" when 'inherit' 'style="color: inherit"' else '' end end |