Class: Pennyworth::Kit
- Inherits:
-
Object
- Object
- Pennyworth::Kit
- Defined in:
- lib/pennyworth/kit.rb
Overview
Provides supplementary utility methods.
Class Method Summary collapse
-
.array_to_string(array, delimiter = ' ') ⇒ Object
Builds a string from an array.
-
.clip(text) ⇒ Object
Sends text to the Mac OS clipboard.
Class Method Details
.array_to_string(array, delimiter = ' ') ⇒ Object
Builds a string from an array.
Parameters
-
array
- Required. The array to build a string from. -
delimiter
- Optional. The delimiter used to join each array element. Default: ‘ ’
8 9 10 |
# File 'lib/pennyworth/kit.rb', line 8 def self.array_to_string array, delimiter = ' ' array * delimiter end |
.clip(text) ⇒ Object
Sends text to the Mac OS clipboard.
Parameters
-
text
- Required. The text to send to the clipboard.
15 16 17 18 |
# File 'lib/pennyworth/kit.rb', line 15 def self.clip text IO.popen("pbcopy", 'w').print text text end |