Sha256: 853ebecc22d54bae1d2a21fdef6292eb13b11c249d6a484e5aa96a80be629b84

Contents?: true

Size: 667 Bytes

Versions: 3

Compression:

Stored size: 667 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
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
osheet-0.6.0 lib/osheet/mixin.rb
osheet-0.5.0 lib/osheet/mixin.rb
osheet-0.4.0 lib/osheet/mixin.rb