Sha256: 0ceb8ed775d294855275411853b634aa7601c6a927adf30502751bf57f70231a

Contents?: true

Size: 476 Bytes

Versions: 5

Compression:

Stored size: 476 Bytes

Contents

module Compositor
  class Leaf < Compositor::Base

    def root
      if @root.is_a?(Symbol)
        super
      elsif @root
        root_class_name.to_sym
      else
        nil
      end
    end

    def composite?
      false
    end

    def dsl(dsl)
      if dsl.generator
        raise "Leaves should be called within composite" unless dsl.generator.composite?
        dsl.generator.collection << self
      else
        dsl.generator = self
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
compositor-2.0.0 lib/compositor/leaf.rb
compositor-1.0.1 lib/compositor/leaf.rb
compositor-1.0.0 lib/compositor/leaf.rb
compositor-0.1.4 lib/compositor/leaf.rb
compositor-0.1.3 lib/compositor/leaf.rb