Sha256: 18a58a8c9dc9460a18236173f2dcf424c2e0a3e786e8e6118522fd682c1109ea

Contents?: true

Size: 896 Bytes

Versions: 6

Compression:

Stored size: 896 Bytes

Contents

require 'osheet/style'
require 'osheet/template'

module Osheet::Mixin

  def self.included(receiver)
    receiver.send(:extend, ClassMethods)
  end

  module ClassMethods
    def style(*selectors, &block)
      instance_variable_set("@s",
        (instance_variable_get("@s") || []) << ::Osheet::Style.new(*selectors, &block)
      )
    end
    def styles
      instance_variable_get("@s") || []
    end

    def template(element, name, &block)
      instance_variable_set("@t",
        (instance_variable_get("@t") || []) << ::Osheet::Template.new(element, name, &block)
      )
    end
    def templates
      instance_variable_get("@t") || []
    end

    def partial(name, &block)
      instance_variable_set("@p",
        (instance_variable_get("@p") || []) << ::Osheet::Partial.new(name, &block)
      )
    end
    def partials
      instance_variable_get("@p") || []
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

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