Class: Sinatra::Hat::HashMutator

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatras-hat/hash_mutator.rb

Overview

Used for specifying custom responses using a corny DSL.

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ HashMutator

Returns a new instance of HashMutator.



5
6
7
# File 'lib/sinatras-hat/hash_mutator.rb', line 5

def initialize(hash)
  @hash = hash
end

Instance Method Details

#failure(&block) ⇒ Object



13
14
15
# File 'lib/sinatras-hat/hash_mutator.rb', line 13

def failure(&block)
  @hash[:failure] = block
end

#success(&block) ⇒ Object



9
10
11
# File 'lib/sinatras-hat/hash_mutator.rb', line 9

def success(&block)
  @hash[:success] = block
end