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, ref: nil) ⇒ WorkingCopy

Returns a new instance of WorkingCopy.



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

def initialize(copied_to: nil,
               full_name: nil,
               ref: 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
    @ref = ref
  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

#refObject (readonly)

Returns the value of attribute ref.



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

def ref
  @ref
end

Instance Method Details

#==(other) ⇒ Object



28
29
30
31
32
33
# File 'lib/bookbinder/ingest/working_copy.rb', line 28

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

#available?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/bookbinder/ingest/working_copy.rb', line 20

def available?
  !! @copied_to
end

#pathObject



24
25
26
# File 'lib/bookbinder/ingest/working_copy.rb', line 24

def path
  Pathname(@copied_to)
end