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
107 108 109 |
# File 'lib/plate/compiler.rb', line 107 def compile(compiler, parent = nil) compile_value end |
#compile_value ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/plate/compiler.rb', line 80 def compile_value case value when 'blank' 'target="_blank"' when /\Abtn/ c = 'btn' c << ' btn-primary' if value =~ /\-primary/ c << ' btn-default' if c == 'btn' c << ' btn-lg' if value =~ /\-lg/ c << ' btn-sm' if value =~ /\-sm/ c << ' btn-block' if value =~ /\-block/ "class=\"#{c}\"" when /spin(\-\d+\.*\d*)?/ s = value.gsub(/spin\-?/, '') s = 1.5 if s.empty? animation = "animation: spin #{s}s linear infinite" "style=\"-webkit-#{animation}; #{animation}\"" when 'inherit' 'style="color: inherit"' else '' end end |