Class: Shoestring::Generic

Inherits:
Base
  • Object
show all
Defined in:
lib/shoestring/generic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

check

Constructor Details

#initialize(name, message = "Unable to check #{name}", &block) ⇒ Generic

Returns a new instance of Generic.



5
6
7
8
9
# File 'lib/shoestring/generic.rb', line 5

def initialize(name, message="Unable to check #{name}", &block)
  @name = name
  @message = message
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



3
4
5
# File 'lib/shoestring/generic.rb', line 3

def block
  @block
end

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/shoestring/generic.rb', line 3

def message
  @message
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/shoestring/generic.rb', line 3

def name
  @name
end

Instance Method Details

#checkObject



11
12
13
14
# File 'lib/shoestring/generic.rb', line 11

def check
  block.call || abort(message)
  puts "#{name}: check!"
end