class Keepasser::Entry

Attributes

fields[R]
group[RW]

Public Class Methods

new(data) click to toggle source
# File lib/keepasser/entry.rb, line 6
def initialize data
  @fields = {}
  data.map do |d|
    parts = d.split ':'
    if parts[1]
      @fields[parts[0].downcase.strip] = parts[1].strip
    end
  end

  @fields['comment'] = [@fields['comment']] if @fields['comment']
  data.select { |f| f[0..5] == '      ' }.map { |c| @fields['comment'].push c.strip }
end

Public Instance Methods

==(other) click to toggle source
# File lib/keepasser/entry.rb, line 27
def == other
  @fields == other.fields
end
[](key) click to toggle source
# File lib/keepasser/entry.rb, line 19
def [] key
  @fields[key]
end
method_missing(m, *args) click to toggle source
# File lib/keepasser/entry.rb, line 23
def method_missing m, *args
  @fields[m.to_s]
end