Module: BadPigeon::Assertions
- Included in:
- EntryFilter, HomeTimeline, ListTimeline, StrictHash, TimelineEntry, TimelineInstruction, TimelineTweet, Tweet, Tweet, TweetExtractor, UserTimeline
- Defined in:
- lib/bad_pigeon/util/assertions.rb
Class Method Summary collapse
Class Method Details
.extended(target) ⇒ Object
23 24 25 |
# File 'lib/bad_pigeon/util/assertions.rb', line 23 def self.extended(target) included(target.singleton_class) end |
.included(target) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/bad_pigeon/util/assertions.rb', line 7 def self.included(target) if ENV['ANGRY_PIGEON'] == '1' target.define_method(:assert) do |msg = nil, &block| raise AngryPigeon::AssertionError.new(msg) if msg || block.call == false end target.define_method(:debug) do |msg| $stderr.puts msg end else target.define_method(:assert) do |msg = nil, &block| end target.define_method(:debug) do |msg| end end end |