Class: Cooklang::Note

Inherits:
Object
  • Object
show all
Defined in:
lib/cooklang/note.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content:) ⇒ Note



7
8
9
# File 'lib/cooklang/note.rb', line 7

def initialize(content:)
  @content = content.to_s.freeze
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



5
6
7
# File 'lib/cooklang/note.rb', line 5

def content
  @content
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
# File 'lib/cooklang/note.rb', line 19

def ==(other)
  other.is_a?(Note) && content == other.content
end

#hashObject



23
24
25
# File 'lib/cooklang/note.rb', line 23

def hash
  content.hash
end

#to_hObject



15
16
17
# File 'lib/cooklang/note.rb', line 15

def to_h
  { content: content }
end

#to_sObject



11
12
13
# File 'lib/cooklang/note.rb', line 11

def to_s
  content
end