Class: Qo::Branches::ElseBranch

Inherits:
Branch
  • Object
show all
Defined in:
lib/qo/branches/else_branch.rb

Overview

A default branch to for when other conditions fail.

Qo.case(1) { |m|
  m.else { |v| v + 2 }
}
# => 3

Author:

  • baweaver

Since:

  • 1.0.0

Constant Summary

Constants inherited from Branch

Branch::UNMATCHED

Instance Attribute Summary

Attributes inherited from Branch

#name

Instance Method Summary collapse

Methods inherited from Branch

create, #create_matcher, #default?

Constructor Details

#initialize(destructure: false) ⇒ ElseBranch

Returns a new instance of ElseBranch

Since:

  • 1.0.0



15
16
17
# File 'lib/qo/branches/else_branch.rb', line 15

def initialize(destructure: false)
  super(name: 'else', destructure: destructure, default: true)
end