Sha256: 96e030bada6ccd76c9b299bfddc7ddaa432b63b9904f6e1169457cc012923918

Contents?: true

Size: 668 Bytes

Versions: 7

Compression:

Stored size: 668 Bytes

Contents

module Osheet
  class Partial < ::Proc

    # this class is essentially a way to define a named definition
    #  block with arguments.  If the partial is added to an element,
    #  any markup in it's definition block is applied to the element.
    #  ie. the definition block will be instance_eval'd on the element.

    include Instance

    def initialize(name)
      unless name.kind_of?(::String) || name.kind_of?(::Symbol)
        raise ArgumentError, "please use a string or symbol for the partial name."
      end

      set_ivar(:name, name.to_s)
      super()
    end

    def name; get_ivar(:name); end
    def name=(v); set_ivar(:name, v); end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
osheet-0.10.0 lib/osheet/partial.rb
osheet-0.9.2 lib/osheet/partial.rb
osheet-0.9.1 lib/osheet/partial.rb
osheet-0.9.0 lib/osheet/partial.rb
osheet-0.8.0 lib/osheet/partial.rb
osheet-0.7.0 lib/osheet/partial.rb
osheet-0.6.0 lib/osheet/partial.rb