Class: Leadlight::Tint

Inherits:
Module
  • Object
show all
Defined in:
lib/leadlight/tint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}, &block) ⇒ Tint

Returns a new instance of Tint.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/leadlight/tint.rb', line 6

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/leadlight/tint.rb', line 5

def name
  @name
end

Instance Method Details

#inspectObject



22
23
24
# File 'lib/leadlight/tint.rb', line 22

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

#to_sObject



26
27
28
# File 'lib/leadlight/tint.rb', line 26

def to_s
  inspect
end