Module: Cutter::Stamper::ClassMethods
- Included in:
- Cutter::Stamper
- Defined in:
- lib/cutter/stamper.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #last ⇒ Object
- #pop ⇒ Object
- #push(stamper) ⇒ Object
- #scope(label) {|stamper| ... } ⇒ Object
Instance Method Details
#[](key) ⇒ Object
135 136 137 |
# File 'lib/cutter/stamper.rb', line 135 def [] key stampers[key] end |
#last ⇒ Object
123 124 125 |
# File 'lib/cutter/stamper.rb', line 123 def last stamper_stack.last end |
#pop ⇒ Object
131 132 133 |
# File 'lib/cutter/stamper.rb', line 131 def pop stamper_stack.pop end |
#push(stamper) ⇒ Object
127 128 129 |
# File 'lib/cutter/stamper.rb', line 127 def push stamper stamper_stack.push stamper end |
#scope(label) {|stamper| ... } ⇒ Object
113 114 115 116 117 118 119 120 121 |
# File 'lib/cutter/stamper.rb', line 113 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 |