Sha256: 6503571061348914f2cf4e171b520c5cbd586ba82efd724428d84f1f70d5c417

Contents?: true

Size: 668 Bytes

Versions: 14

Compression:

Stored size: 668 Bytes

Contents

module Rbexy
  module Nodes
    class ComponentProp < AbstractAttr
      def precompile
        [ComponentProp.new(name, precompile_value)]
      end

      def compile
        key = ActiveSupport::Inflector.underscore(name)
        "#{key}: #{value.compile}"
      end

      private

      def precompile_value
        node = value.precompile.first

        case node
        when Raw
          Raw.new(node.content, template: Raw::EXPR_STRING)
        when ExpressionGroup
          ExpressionGroup.new(node.members, outer_template: ExpressionGroup::SUB_EXPR, inner_template: node.inner_template)
        else
          node
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rbexy-2.0.0.rc5 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.rc4 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.rc3 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.rc2 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.rc1 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.beta9 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.beta8 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.beta7 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.beta6 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.beta5 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.beta4 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.beta3 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.beta2 lib/rbexy/nodes/component_prop.rb
rbexy-2.0.0.beta1 lib/rbexy/nodes/component_prop.rb