Class: Bookbinder::Ingest::WorkingCopy

Inherits:
Object
  • Object
show all
Defined in:
lib/bookbinder/ingest/working_copy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(copied_to: nil, full_name: nil) ⇒ WorkingCopy

Returns a new instance of WorkingCopy.



8
9
10
11
12
13
14
15
16
# File 'lib/bookbinder/ingest/working_copy.rb', line 8

def initialize(copied_to: nil,
               full_name: nil)
  if [copied_to, full_name].none?
    raise Errors::ProgrammerMistake.new("Must provide copied_to and/or full_name to WorkingCopy.new")
  else
    @copied_to = copied_to
    @full_name = full_name
  end
end

Instance Attribute Details

#full_nameObject (readonly)

Returns the value of attribute full_name.



6
7
8
# File 'lib/bookbinder/ingest/working_copy.rb', line 6

def full_name
  @full_name
end

Instance Method Details

#==(other) ⇒ Object



26
27
28
29
30
# File 'lib/bookbinder/ingest/working_copy.rb', line 26

def ==(other)
  [@copied_to, @full_name] ==
    [other.instance_variable_get(:@copied_to),
     other.instance_variable_get(:@full_name)]
end

#available?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/bookbinder/ingest/working_copy.rb', line 18

def available?
  !! @copied_to
end

#pathObject



22
23
24
# File 'lib/bookbinder/ingest/working_copy.rb', line 22

def path
  Pathname(@copied_to)
end