Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/redmine_cli/helpers/monkey_patching.rb

Instance Method Summary collapse

Instance Method Details

#cut(max_chars) ⇒ Object

If string doesnt fit in ‘max_chars` then it will cut it and add ’…‘



5
6
7
8
9
# File 'lib/redmine_cli/helpers/monkey_patching.rb', line 5

def cut(max_chars)
  return self if size <= max_chars

  self[0...max_chars - 3] + '...'
end

#numeric?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
# File 'lib/redmine_cli/helpers/monkey_patching.rb', line 11

def numeric?
  Integer(self)
rescue
  false
end