class FLACsmith::Metadata::Formatter

Converts text into a key/value pair.

Attributes

text[R]

Public Class Methods

new(text) click to toggle source
# File lib/flacsmith/metadata/formatter.rb, line 7
def initialize text
  @text = String text
end

Public Instance Methods

to_h() click to toggle source
# File lib/flacsmith/metadata/formatter.rb, line 11
def to_h
  text.split("\n").reduce({}) do |new_hash, line|
    key, value = line.split "="
    new_hash.merge key => value
  end
end