Class: Glimmer::DSL::Web::StyleExpression

Inherits:
Expression
  • Object
show all
Includes:
Glimmer, GeneralElementExpression
Defined in:
lib/glimmer/dsl/web/style_expression.rb

Instance Method Summary collapse

Methods included from GeneralElementExpression

#interpret

Instance Method Details

#add_content(parent, keyword, *args, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/glimmer/dsl/web/style_expression.rb', line 16

def add_content(parent, keyword, *args, &block)
  if parent.rendered? || parent.skip_content_on_render_blocks?
    return_value = css(&block).to_s
    return_value = super(parent, keyword, *args, &block) if return_value.to_s.empty?
    if return_value.is_a?(String) && parent.dom_element.text.to_s.empty?
      parent.add_text_content(return_value)
    end
    parent.post_add_content
    return_value
  else
    parent.add_content_on_render(&block)
  end
end

#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/glimmer/dsl/web/style_expression.rb', line 11

def can_interpret?(parent, keyword, *args, &block)
  keyword == 'style' &&
    !block.nil?
end