Class: Tankobon::Stageable
- Inherits:
-
Object
- Object
- Tankobon::Stageable
- Defined in:
- lib/tankobon/stageable.rb
Instance Method Summary collapse
-
#initialize(stageable) ⇒ Stageable
constructor
A new instance of Stageable.
- #stage ⇒ Object
- #stage_root ⇒ Object
- #stageable ⇒ Object
- #to_stage(&block) ⇒ Object
Constructor Details
#initialize(stageable) ⇒ Stageable
Returns a new instance of Stageable.
5 6 7 |
# File 'lib/tankobon/stageable.rb', line 5 def initialize(stageable) @stageable = Pathname.new(stageable) end |
Instance Method Details
#stage ⇒ Object
13 14 15 |
# File 'lib/tankobon/stageable.rb', line 13 def stage stage_root + @stageable.basename('.*') end |
#stage_root ⇒ Object
9 10 11 |
# File 'lib/tankobon/stageable.rb', line 9 def stage_root Pathname.new("~/tankobon2"). end |
#stageable ⇒ Object
17 18 19 |
# File 'lib/tankobon/stageable.rb', line 17 def stageable @stageable. end |
#to_stage(&block) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/tankobon/stageable.rb', line 21 def to_stage(&block) FileUtils.mkdir_p(stage.dirname) unless stage.dirname.exist? FileUtils.rm_r(stage) if stage.exist? yield if block_given? StagedDirectory.new(stage) end |