Class: Appydave::Tools::ZshHistory::Command
- Inherits:
-
Struct
- Object
- Struct
- Appydave::Tools::ZshHistory::Command
- Defined in:
- lib/appydave/tools/zsh_history/command.rb
Overview
Represents a single command from ZSH history
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#datetime ⇒ Object
Returns the value of attribute datetime.
-
#is_multiline ⇒ Object
Returns the value of attribute is_multiline.
-
#matched_pattern ⇒ Object
Returns the value of attribute matched_pattern.
-
#raw_lines ⇒ Object
Returns the value of attribute raw_lines.
-
#text ⇒ Object
Returns the value of attribute text.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category
7 8 9 |
# File 'lib/appydave/tools/zsh_history/command.rb', line 7 def category @category end |
#datetime ⇒ Object
Returns the value of attribute datetime
7 8 9 |
# File 'lib/appydave/tools/zsh_history/command.rb', line 7 def datetime @datetime end |
#is_multiline ⇒ Object
Returns the value of attribute is_multiline
7 8 9 |
# File 'lib/appydave/tools/zsh_history/command.rb', line 7 def is_multiline @is_multiline end |
#matched_pattern ⇒ Object
Returns the value of attribute matched_pattern
7 8 9 |
# File 'lib/appydave/tools/zsh_history/command.rb', line 7 def matched_pattern @matched_pattern end |
#raw_lines ⇒ Object
Returns the value of attribute raw_lines
7 8 9 |
# File 'lib/appydave/tools/zsh_history/command.rb', line 7 def raw_lines @raw_lines end |
#text ⇒ Object
Returns the value of attribute text
7 8 9 |
# File 'lib/appydave/tools/zsh_history/command.rb', line 7 def text @text end |
#timestamp ⇒ Object
Returns the value of attribute timestamp
7 8 9 |
# File 'lib/appydave/tools/zsh_history/command.rb', line 7 def @timestamp end |
Instance Method Details
#formatted_datetime(format = '%Y-%m-%d %H:%M:%S') ⇒ Object
17 18 19 |
# File 'lib/appydave/tools/zsh_history/command.rb', line 17 def formatted_datetime(format = '%Y-%m-%d %H:%M:%S') datetime&.strftime(format) || 'unknown' end |
#to_history_format ⇒ Object
21 22 23 24 |
# File 'lib/appydave/tools/zsh_history/command.rb', line 21 def to_history_format # Reconstruct in ZSH history format for writing back raw_lines.join("\n") end |