Class: CoachZed::Catalog::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/coach_zed/catalog.rb,
sig/coach_zed.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, relative_path:, title:, summary:, work_items:, notes:, source_urls:, domain: nil, session_duration: nil, precedence: nil, frequency: nil, program: nil, format: nil, equipment: nil) ⇒ Entry

Returns a new instance of Entry.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/coach_zed/catalog.rb', line 11

def initialize(
  path:,
  relative_path:,
  title:,
  summary:,
  work_items:,
  notes:,
  source_urls:,
  domain: nil,
  session_duration: nil,
  precedence: nil,
  frequency: nil,
  program: nil,
  format: nil,
  equipment: nil
)
  @path = path
  @relative_path = relative_path
  @title = title
  @domain = domain
  @session_duration = session_duration
  @precedence = precedence
  @frequency = frequency
  @program = program
  @format = format
  @equipment = equipment
  @summary = summary
  @work_items = work_items
  @notes = notes
  @source_urls = source_urls
end

Instance Attribute Details

#domainString? (readonly)

Returns the value of attribute domain.

Returns:

  • (String, nil)


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def domain
  @domain
end

#equipmentString? (readonly)

Returns the value of attribute equipment.

Returns:

  • (String, nil)


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def equipment
  @equipment
end

#formatString? (readonly)

Returns the value of attribute format.

Returns:

  • (String, nil)


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def format
  @format
end

#frequencyString? (readonly)

Returns the value of attribute frequency.

Returns:

  • (String, nil)


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def frequency
  @frequency
end

#notesArray[String] (readonly)

Returns the value of attribute notes.

Returns:

  • (Array[String])


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def notes
  @notes
end

#pathPathname (readonly)

Returns the value of attribute path.

Returns:

  • (Pathname)


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def path
  @path
end

#precedenceString? (readonly)

Returns the value of attribute precedence.

Returns:

  • (String, nil)


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def precedence
  @precedence
end

#programString? (readonly)

Returns the value of attribute program.

Returns:

  • (String, nil)


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def program
  @program
end

#relative_pathString (readonly)

Returns the value of attribute relative_path.

Returns:

  • (String)


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def relative_path
  @relative_path
end

#session_durationString? (readonly)

Returns the value of attribute session_duration.

Returns:

  • (String, nil)


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def session_duration
  @session_duration
end

#source_urlsArray[String] (readonly)

Returns the value of attribute source_urls.

Returns:

  • (Array[String])


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def source_urls
  @source_urls
end

#summaryString (readonly)

Returns the value of attribute summary.

Returns:

  • (String)


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def summary
  @summary
end

#titleString (readonly)

Returns the value of attribute title.

Returns:

  • (String)


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def title
  @title
end

#work_itemsArray[String] (readonly)

Returns the value of attribute work_items.

Returns:

  • (Array[String])


9
10
11
# File 'lib/coach_zed/catalog.rb', line 9

def work_items
  @work_items
end

Instance Method Details

#fingerprintString

Returns:

  • (String)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/coach_zed/catalog.rb', line 43

def fingerprint
  Digest::SHA256.hexdigest([
    relative_path,
    title,
    domain,
    session_duration,
    precedence,
    frequency,
    program,
    format,
    equipment,
    summary,
    work_items.join("\n"),
    notes.join("\n"),
    source_urls.join("\n")
  ].join("\u0000"))
end

#to_hHash[String, untyped]

Returns:

  • (Hash[String, untyped])


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/coach_zed/catalog.rb', line 61

def to_h
  {
    "path" => path.to_s,
    "relative_path" => relative_path,
    "title" => title,
    "domain" => domain,
    "session_duration" => session_duration,
    "precedence" => precedence,
    "frequency" => frequency,
    "program" => program,
    "format" => format,
    "equipment" => equipment,
    "summary" => summary,
    "work_items" => work_items,
    "notes" => notes,
    "source_urls" => source_urls
  }
end