Class: EJX::Template::HTMLTag::AttributeValue
- Inherits:
-
Object
- Object
- EJX::Template::HTMLTag::AttributeValue
- Defined in:
- lib/ejx/template/html_tag/attribute_value.rb
Instance Method Summary collapse
-
#initialize(values) ⇒ AttributeValue
constructor
A new instance of AttributeValue.
- #to_js ⇒ Object
Constructor Details
#initialize(values) ⇒ AttributeValue
Returns a new instance of AttributeValue.
3 4 5 |
# File 'lib/ejx/template/html_tag/attribute_value.rb', line 3 def initialize(values) @values = values end |
Instance Method Details
#to_js ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/ejx/template/html_tag/attribute_value.rb', line 7 def to_js if @values.empty? JSON.generate('') else @values.map{ |v| v.is_a?(::String) ? JSON.generate(v) : v.value }.join(' + ') end end |