Class: CoachZed::Catalog::Entry

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

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, 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
# 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,
  frequency: nil,
  program: nil,
  format: nil,
  equipment: nil
)
  @path = path
  @relative_path = relative_path
  @title = title
  @domain = domain
  @session_duration = session_duration
  @frequency = frequency
  @program = program
  @format = format
  @equipment = equipment
  @summary = summary
  @work_items = work_items
  @notes = notes
  @source_urls = source_urls
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



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

def domain
  @domain
end

#equipmentObject (readonly)

Returns the value of attribute equipment.



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

def equipment
  @equipment
end

#formatObject (readonly)

Returns the value of attribute format.



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

def format
  @format
end

#frequencyObject (readonly)

Returns the value of attribute frequency.



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

def frequency
  @frequency
end

#notesObject (readonly)

Returns the value of attribute notes.



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

def notes
  @notes
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

#programObject (readonly)

Returns the value of attribute program.



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

def program
  @program
end

#relative_pathObject (readonly)

Returns the value of attribute relative_path.



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

def relative_path
  @relative_path
end

#session_durationObject (readonly)

Returns the value of attribute session_duration.



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

def session_duration
  @session_duration
end

#source_urlsObject (readonly)

Returns the value of attribute source_urls.



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

def source_urls
  @source_urls
end

#summaryObject (readonly)

Returns the value of attribute summary.



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

def summary
  @summary
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

#work_itemsObject (readonly)

Returns the value of attribute work_items.



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

def work_items
  @work_items
end

Instance Method Details

#fingerprintObject



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

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

#to_hObject



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/coach_zed/catalog.rb', line 58

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