Class: Persistent::Shell::Command

Inherits:
Struct
  • Object
show all
Defined in:
lib/persistent-shell-history/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cmdObject

Returns the value of attribute cmd

Returns:

  • (Object)

    the current value of cmd



7
8
9
# File 'lib/persistent-shell-history/command.rb', line 7

def cmd
  @cmd
end

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time



7
8
9
# File 'lib/persistent-shell-history/command.rb', line 7

def time
  @time
end

Instance Method Details

#md5Object



8
9
10
# File 'lib/persistent-shell-history/command.rb', line 8

def md5
  Digest::MD5.hexdigest(cmd)
end

#to_hObject



11
12
13
# File 'lib/persistent-shell-history/command.rb', line 11

def to_h
  { :cmd => cmd, :time => time, }
end

#to_json(*a) ⇒ Object



14
15
16
# File 'lib/persistent-shell-history/command.rb', line 14

def to_json(*a)
  to_h.to_json(*a)
end