Sha256: a8bec6c852596230a4f14e5a909ab80715e1f26dff4897437b0416176e9fe75c
Contents?: true
Size: 666 Bytes
Versions: 1
Compression:
Stored size: 666 Bytes
Contents
require_relative 'logger' module Annoyme class Remover def initialize(file) @file = file end def remove(note) notes = @file.parse if is_number?(note) note = notes.delete_at((note.to_i - 1)) if note.nil? Logger.red('error', 'Seems like your specified number was out of index') return end @file.write(notes) Logger.red('deleted', "#{note}") else Logger.red('error', 'You did not specify a note using a number') end end private def is_number?(string) if Float(string) true end rescue false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
annoyme-1.0.0 | lib/annoyme/remover.rb |