Method: FormatEngine::SpecInfo#grab

Defined in:
lib/format_engine/spec_info.rb

#grabObject

Grab some text



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/format_engine/spec_info.rb', line 74

def grab
  width = fmt.width

  if width > 0
    result, @src = src[0...width], src[width..-1] || ""
  elsif width == 0
    result, @src = src[0...1], src[1..-1] || ""
  elsif width == -1
    result, @src = src, ""
  else
    result, @src = src[0..width], src[(width+1)..-1] || ""
  end

  result
end