Class: ActiveFedora::Noid::Minter::File
- Defined in:
- lib/active_fedora/noid/minter/file.rb
Instance Attribute Summary collapse
-
#statefile ⇒ Object
readonly
Returns the value of attribute statefile.
Instance Method Summary collapse
- #default_statefile ⇒ Object
-
#initialize(template = default_template, statefile = default_statefile) ⇒ File
constructor
A new instance of File.
- #read ⇒ Object
- #write!(minter) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(template = default_template, statefile = default_statefile) ⇒ File
Returns a new instance of File.
10 11 12 13 |
# File 'lib/active_fedora/noid/minter/file.rb', line 10 def initialize(template = default_template, statefile = default_statefile) @statefile = statefile super(template) end |
Instance Attribute Details
#statefile ⇒ Object (readonly)
Returns the value of attribute statefile.
8 9 10 |
# File 'lib/active_fedora/noid/minter/file.rb', line 8 def statefile @statefile end |
Instance Method Details
#default_statefile ⇒ Object
15 16 17 |
# File 'lib/active_fedora/noid/minter/file.rb', line 15 def default_statefile ActiveFedora::Noid.config.statefile end |
#read ⇒ Object
19 20 21 22 23 |
# File 'lib/active_fedora/noid/minter/file.rb', line 19 def read with_file do |f| state_for(f) end end |
#write!(minter) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/active_fedora/noid/minter/file.rb', line 25 def write!(minter) with_file do |f| # Wipe prior contents so the new state can be written from the beginning of the file f.truncate(0) f.write(Marshal.dump(minter.dump)) end end |