module Cutter::Stamper::ClassMethods

Public Instance Methods

[](key) click to toggle source
# File lib/cutter/stamper.rb, line 164
def [] key
  stampers[key]
end
last() click to toggle source
# File lib/cutter/stamper.rb, line 152
def last
  stamper_stack.last
end
pop() click to toggle source
# File lib/cutter/stamper.rb, line 160
def pop
  stamper_stack.pop
end
push(stamper) click to toggle source
# File lib/cutter/stamper.rb, line 156
def push stamper
  stamper_stack.push stamper
end
scope(label) { |stamper| ... } click to toggle source
# File lib/cutter/stamper.rb, line 142
def scope label, &block
  raise ArgumentError, "Must have hash, was: #{label}" if !label.kind_of? Hash
  raise ArgumentError, "Must have block" if !block
  stamper = Stamper.new(label)
  stampers[label.keys.first] = stamper
  yield stamper
  stamper_stack.pop
  stamper
end

Protected Instance Methods

stamper_stack() click to toggle source
# File lib/cutter/stamper.rb, line 170
def stamper_stack
  @stamper_stack ||= []
end
stampers() click to toggle source
# File lib/cutter/stamper.rb, line 174
def stampers
  @stampers ||= {}
end