Sha256: fb4b732f6409befbb67ec1371d014b6f34e70e5d5c9ab92b24ea868311176220

Contents?: true

Size: 984 Bytes

Versions: 31

Compression:

Stored size: 984 Bytes

Contents

# @Opulent
module Opulent
  # @Nodes
  module Nodes
    # @Evaluate
    #
    # The eval node evaluates ruby code in the given context without printing
    # any output in the page
    #
    class Evaluate
      attr_accessor :value, :parent, :indent, :children, :name

      # Ruby code evaluation node
      #
      # @param name [String] name of the html node
      # @param parent [Node] parent of the element
      # @param indent [Fixnum] node indentation for restructuring
      # @param children [Array] contents to be interpreted
      #
      def initialize(value = '', parent = nil, indent = 0, children = [])
        @name = :eval
        @value = value
        @parent = parent
        @indent = indent
        @children = children
      end

      # Add a new node to the nodes array
      #
      def push(node)
        @children << node
        self
      end

      def evaluate(context)
        context.evaluate @value
        return nil
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
opulent-1.5.5 .libold/opulent/nodes/eval.rb
opulent-1.5.4 .libold/opulent/nodes/eval.rb
opulent-1.5.3 .libold/opulent/nodes/eval.rb
opulent-1.5.2 .libold/opulent/nodes/eval.rb
opulent-1.5.1 .libold/opulent/nodes/eval.rb
opulent-1.5.0 .libold/opulent/nodes/eval.rb
opulent-1.4.8 .libold/opulent/nodes/eval.rb
opulent-1.4.7 .libold/opulent/nodes/eval.rb
opulent-1.4.6 .libold/opulent/nodes/eval.rb
opulent-1.4.5 .libold/opulent/nodes/eval.rb
opulent-1.4.3 .libold/opulent/nodes/eval.rb
opulent-1.4.2 .libold/opulent/nodes/eval.rb
opulent-1.4.1 .libold/opulent/nodes/eval.rb
opulent-1.4.0 .libold/opulent/nodes/eval.rb
opulent-1.3.3 .libold/opulent/nodes/eval.rb
opulent-1.3.2 .libold/opulent/nodes/eval.rb
opulent-1.3.1 .libold/opulent/nodes/eval.rb
opulent-1.3.0 .libold/opulent/nodes/eval.rb
opulent-1.2.1 .libold/opulent/nodes/eval.rb
opulent-1.2.0 .libold/opulent/nodes/eval.rb