Class: Everything::Piece
- Inherits:
-
Object
show all
- Extended by:
- Forwardable
- Defined in:
- lib/everything/piece.rb,
lib/everything/piece/content.rb,
lib/everything/piece/metadata.rb
Defined Under Namespace
Classes: Content, Metadata
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(full_path) ⇒ Piece
Returns a new instance of Piece.
9
10
11
|
# File 'lib/everything/piece.rb', line 9
def initialize(full_path)
@full_path = full_path
end
|
Instance Attribute Details
#full_path ⇒ Object
Returns the value of attribute full_path.
7
8
9
|
# File 'lib/everything/piece.rb', line 7
def full_path
@full_path
end
|
Instance Method Details
#content ⇒ Object
13
14
15
|
# File 'lib/everything/piece.rb', line 13
def content
@content ||= Content.new(full_path)
end
|
19
20
21
|
# File 'lib/everything/piece.rb', line 19
def metadata
@metadata ||= Metadata.new(full_path)
end
|
#name ⇒ Object
29
30
31
|
# File 'lib/everything/piece.rb', line 29
def name
@name ||= File.basename(full_path)
end
|
#public? ⇒ Boolean
23
24
25
|
# File 'lib/everything/piece.rb', line 23
def public?
metadata['public']
end
|
#save ⇒ Object
33
34
35
36
|
# File 'lib/everything/piece.rb', line 33
def save
content.save
metadata.save
end
|