Sha256: 675ae52b3869a8aab8985214f9976cd2bac342354ca234ce18ad3787ead8326e
Contents?: true
Size: 560 Bytes
Versions: 3
Compression:
Stored size: 560 Bytes
Contents
module TinySweeper module Brooms def self.add(broom_name, &block) (@brooms ||= {})[broom_name] = block end def self.has_broom?(broom_name) (@brooms ||= {}).has_key?(broom_name) end def self.fetch(broom_name) if has_broom?(broom_name) (@brooms ||= {})[broom_name] else raise MissingBroomException, broom_name end end end class MissingBroomException < ::StandardError def initialize(broom_name) super("TinySweeper doesn't have this broom: #{broom_name}") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tiny_sweeper-1.1.1 | lib/tiny_sweeper/brooms.rb |
tiny_sweeper-1.0.1 | lib/tiny_sweeper/brooms.rb |
tiny_sweeper-1.0.0 | lib/tiny_sweeper/brooms.rb |