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
164 165 166 |
# File 'lib/cutter/stamper.rb', line 164 def [] key stampers[key] end |
#last ⇒ Object
152 153 154 |
# File 'lib/cutter/stamper.rb', line 152 def last stamper_stack.last end |
#pop ⇒ Object
160 161 162 |
# File 'lib/cutter/stamper.rb', line 160 def pop stamper_stack.pop end |
#push(stamper) ⇒ Object
156 157 158 |
# File 'lib/cutter/stamper.rb', line 156 def push stamper stamper_stack.push stamper end |
#scope(label) {|stamper| ... } ⇒ Object
142 143 144 145 146 147 148 149 150 |
# 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 |