> i'm trying to read a few text values from single file:
>
> =A0if File.exists?(file)
> =A0 =A0 =A0File.open(file, 'r+') do |f|
> =A0 =A0 =A0 =A0value1 =3D f.gets.strip
> =A0 =A0 =A0 =A0value2 =3D f.gets.strip
> =A0 =A0 =A0 =A0value3 =3D f.gets.strip
> =A0 =A0 =A0 =A0value4 =3D f.gets.strip
> =A0 =A0 =A0end
> =A0 =A0end
>
> each value is stored in separate line and 'strip' above is used only to
> get rid of end-of-line characters. is there any easier way to do the same=
?

I tend to strip out all such characters at once, before operating on any li=
ne.

  File.readlines(file).map { |line| line.strip }.each do |line|
    ...
  end

In your case, I guess that would be

  lines =3D File.readlines(file).map { |line| line.strip }
  value1 =3D lines.shift
  value2 =3D lines.shift
  # etc.
  # or
  v1, v2, v3, v4 =3D lines.shift(4)