Class: KBSecret::Record::Snippet

Inherits:
Abstract
  • Object
show all
Defined in:
lib/kbsecret/record/snippet.rb

Overview

Represents a record containing a code snippet and its description.

Instance Attribute Summary

Attributes inherited from Abstract

#data, #label, #path, #session, #timestamp, #type

Instance Method Summary collapse

Methods inherited from Abstract

data_field, data_fields, gen_methods, #initialize_from_hash, load!, #sync!, #to_h, #to_s, type

Constructor Details

#initialize(session, label, code, description) ⇒ Snippet

Returns a new instance of Snippet.

Parameters:

  • session (Session)

    the session to associate with

  • label (Symbol)

    the new record's label

  • code (String)

    the code

  • description (String)

    a description of the code



14
15
16
17
18
19
20
21
22
23
# File 'lib/kbsecret/record/snippet.rb', line 14

def initialize(session, label, code, description)
  super(session, label)

  @data = {
    snippet: {
      code: code,
      description: description,
    },
  }
end