Module: Embrace
- Defined in:
- lib/embrace.rb,
lib/embrace/version.rb,
lib/embrace/brackets.rb,
lib/embrace/string_methods.rb
Defined Under Namespace
Modules: StringMethods
Classes: Brackets
Constant Summary
collapse
- BRACKETS =
Brackets("[", "]").freeze
- PARENTHESES =
Brackets("(", ")").freeze
- BRACES =
Brackets("{", "}").freeze
- VERSION =
"1.2.0"
Class Method Summary
collapse
Class Method Details
.bracket(text, style:, pattern: /\A.*\z/) ⇒ Object
16
17
18
|
# File 'lib/embrace.rb', line 16
def bracket(text, style:, pattern: /\A.*\z/)
text.gsub(pattern, &Brackets(style))
end
|
.bracketer(style:, **options) ⇒ Object
20
21
22
23
|
# File 'lib/embrace.rb', line 20
def bracketer(style:, **options)
brackets = Brackets(style)
->(text) { bracket(text, style: brackets, **options)}
end
|
.Brackets(style, *rest) ⇒ Object