Class: Brackets::Util::BooleanCounter

Inherits:
Object
  • Object
show all
Defined in:
lib/brackets/util/boolean_counter.rb

Instance Method Summary collapse

Constructor Details

#initializeBooleanCounter

Returns a new instance of BooleanCounter.



4
5
6
# File 'lib/brackets/util/boolean_counter.rb', line 4

def initialize
  @counter = 0
end

Instance Method Details

#next_if(boolean, falsey_value = nil) ⇒ Object



8
9
10
# File 'lib/brackets/util/boolean_counter.rb', line 8

def next_if(boolean, falsey_value = nil)
  boolean ? @counter += 1 : falsey_value || @counter
end