-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
オリジナル言語を作る : Domain-Specific Languages #86
・16.3 データファイル? いいえ、プログラムです! EFROR-73
- Loading branch information
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
ex = DesignPattern::Interpreter::Expression.new | ||
|
||
backup 'spec/domains/dsl/data' | ||
backup 'spec/domains/dsl/data/music', file_name('*.mp3' & file_name('*.wav') | ||
backup 'spec/domains/dsl/data/images', except(file_name('*.tmp')) | ||
backup 'spec/domains/dsl/data/music', ex.name('*.mp3') & ex.name('*.wav') | ||
backup 'spec/domains/dsl/data/images', ex.except(ex.name('*.tmp')) | ||
to 'spec/domains/dsl/backup' | ||
interval 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require_relative '../../../../app/domains/design_pattern/interpreter/expression.rb' | ||
require_relative '../../../../app/domains/design_pattern/interpreter/all.rb' | ||
require_relative '../../../../app/domains/design_pattern/interpreter/and.rb' | ||
require_relative '../../../../app/domains/design_pattern/interpreter/bigger.rb' | ||
require_relative '../../../../app/domains/design_pattern/interpreter/file_name.rb' | ||
require_relative '../../../../app/domains/design_pattern/interpreter/not.rb' | ||
require_relative '../../../../app/domains/design_pattern/interpreter/or.rb' | ||
require_relative '../../../../app/domains/design_pattern/interpreter/writable.rb' | ||
|
||
def backup(dir, find_expression= DesignPattern::Interpreter::All.new) | ||
puts "Backup called, source dir=#{dir} find expr=#{find_expression}" | ||
end | ||
|
||
def to(backup_directory) | ||
puts "To called, backup dir=#{backup_directory}" | ||
end | ||
|
||
def interval(minutes) | ||
puts "Interval called, interval = #{minutes} minutes" | ||
end | ||
|
||
eval(File.read('backup.pr')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'rails_helper' | ||
|
||
describe DesignPattern::DSL::Backup do | ||
|
||
end |