Sha256: 40c2f128f9010c5ba7d5c557399a41813e81b66fa739a5d2fc08890524cb179f

Contents?: true

Size: 639 Bytes

Versions: 6

Compression:

Stored size: 639 Bytes

Contents

require 'leadlight/tint_helper'

module Leadlight
  class Tint < Module
    attr_reader :name
    def initialize(name, options={}, &block)
      @name = @tint_name  = name
      status_patterns = Array(options.fetch(:status) { :success })
      tint = self
      super(){
        define_method(:__apply_tint__) do
          super()
          helper = TintHelper.new(self, tint)
          helper.exec_tint do
            match_status(*status_patterns)
            instance_eval(&block)
          end
        end
      }
    end

    def inspect
      "#<Leadlight::Tint:#{@tint_name}>"
    end

    def to_s
      inspect
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
leadlight-0.1.0 lib/leadlight/tint.rb
leadlight-0.0.7 lib/leadlight/tint.rb
leadlight-0.0.6 lib/leadlight/tint.rb
leadlight-0.0.5 lib/leadlight/tint.rb
leadlight-0.0.4 lib/leadlight/tint.rb
leadlight-0.0.3 lib/leadlight/tint.rb