Class: Classifile::Classify
- Inherits:
-
Object
- Object
- Classifile::Classify
- Defined in:
- lib/classifile/classify.rb
Overview
Classify files by DSL
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#to_path ⇒ Object
readonly
Returns the value of attribute to_path.
Instance Method Summary collapse
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
8 9 10 |
# File 'lib/classifile/classify.rb', line 8 def file @file end |
#to_path ⇒ Object (readonly)
Returns the value of attribute to_path.
8 9 10 |
# File 'lib/classifile/classify.rb', line 8 def to_path @to_path end |
Instance Method Details
#run(target_file, to_path, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/classifile/classify.rb', line 10 def run(target_file, to_path, &block) raise "TypeError" unless target_file.is_a?(TargetFile) state = State.new(target_file) state.to_path = to_path state.save_name = target_file.basename begin state.instance_exec(state.file, &block) rescue Failed # Ignored end state.gotcha end |