Class: Everything::Piece

Inherits:
Object
  • 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_pathObject (readonly)

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

#contentObject



13
14
15
# File 'lib/everything/piece.rb', line 13

def content
  @content ||= Content.new(full_path)
end

#metadataObject



19
20
21
# File 'lib/everything/piece.rb', line 19

def 
  @metadata ||= Metadata.new(full_path)
end

#nameObject



29
30
31
# File 'lib/everything/piece.rb', line 29

def name
  @name ||= File.basename(full_path)
end

#public?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/everything/piece.rb', line 23

def public?
  ['public']
end

#saveObject



33
34
35
36
# File 'lib/everything/piece.rb', line 33

def save
  content.save
  .save
end