Module: Embrace::Brackets

Defined in:
lib/embrace/brackets.rb

Defined Under Namespace

Modules: StringMethods

Constant Summary collapse

BRACKET_STYLES =
Hash.new { |_, k| k }.merge({
  "(" => ")",
  "{" => "}",
  "[" => "]",
  "<" => ">"
}).freeze

Class Method Summary collapse

Class Method Details

.wrap(text, style = "(") ⇒ Object



24
25
26
# File 'lib/embrace/brackets.rb', line 24

def wrap(text, style = "(")
  Embrace.wrap(text, style, BRACKET_STYLES[style.to_s])
end

.wrapper(*style) ⇒ Object



28
29
30
# File 'lib/embrace/brackets.rb', line 28

def wrapper(*style)
  ->(text) { wrap(text, *style) }
end