Sha256: 69b38a0f5488158a3b7df8d294a5d6c263d1ed477afd9f710bdb8fd96002a4f6

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

#  ======================================================
#  AText Class
#  ======================================================
class AText
  attr_accessor :filepath, :snippets

  #  ====================================================
  #  Methods
  #  ====================================================
  #  ----------------------------------------------------
  #  initialize method
  #
  #  @param csv_filepath The filepath to the aText CSV
  #  @return Void
  #  ----------------------------------------------------
  def initialize(csv_filepath)
    begin
      @filepath = csv_filepath
      @snippets = CSV.read(csv_filepath)
    rescue 
      fail "Invalid aText CSV file: #{ csv_filepath }"
    end
  end
  
  #  ----------------------------------------------------
  #  construct_data method
  #
  #  Outputs a CSV listing of the supplied snippets
  #  @param new_snippets The snippet array to use
  #  @return String
  #  ----------------------------------------------------
  def construct_data(new_snippets)
    CSV.generate { |csv| new_snippets.each { |s| csv << [s[0], s[1]] } }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
expandsync-0.1.0 lib/expandsync/atext.rb