Class: AdLint::Cc1::BreakEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/adlint/cc1/branch.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ BreakEvent

Returns a new instance of BreakEvent.



286
287
288
# File 'lib/adlint/cc1/branch.rb', line 286

def initialize(type)
  @type = type
end

Class Method Details

.catch(&block) ⇒ Object



266
267
268
# File 'lib/adlint/cc1/branch.rb', line 266

def catch(&block)
  Kernel.catch(:break) { yield; nil }
end

.of_breakObject



270
271
272
# File 'lib/adlint/cc1/branch.rb', line 270

def of_break
  new(:break)
end

.of_continueObject



275
276
277
# File 'lib/adlint/cc1/branch.rb', line 275

def of_continue
  new(:continue)
end

.of_returnObject



280
281
282
# File 'lib/adlint/cc1/branch.rb', line 280

def of_return
  new(:return)
end

Instance Method Details

#break?Boolean

Returns:

  • (Boolean)


291
292
293
# File 'lib/adlint/cc1/branch.rb', line 291

def break?
  @type == :break
end

#continue?Boolean

Returns:

  • (Boolean)


295
296
297
# File 'lib/adlint/cc1/branch.rb', line 295

def continue?
  @type == :continue
end

#return?Boolean

Returns:

  • (Boolean)


299
300
301
# File 'lib/adlint/cc1/branch.rb', line 299

def return?
  @type == :return
end

#throwObject



303
304
305
# File 'lib/adlint/cc1/branch.rb', line 303

def throw
  Kernel.throw(:break, self)
end