Module: AnnotateRb::Helper
- Defined in:
- lib/annotate_rb/helper.rb
Class Method Summary collapse
-
.fallback(*args) ⇒ Object
TODO: Find another implementation that doesn’t depend on ActiveSupport.
- .width(string) ⇒ Object
Class Method Details
.fallback(*args) ⇒ Object
TODO: Find another implementation that doesn’t depend on ActiveSupport
11 12 13 |
# File 'lib/annotate_rb/helper.rb', line 11 def fallback(*args) args.compact.detect(&:present?) end |
.width(string) ⇒ Object
6 7 8 |
# File 'lib/annotate_rb/helper.rb', line 6 def width(string) string.chars.inject(0) { |acc, elem| acc + ((elem.bytesize == 3) ? 2 : 1) } end |