Class: SashimiTanpopo::DSL::EvalContext
- Inherits:
-
Object
- Object
- SashimiTanpopo::DSL::EvalContext
- Defined in:
- lib/sashimi_tanpopo/dsl.rb
Instance Method Summary collapse
-
#changed_files ⇒ Hash<String, { before_content: String, after_content: String, mode: String }>
Key: file path, value: Hash.
-
#dry_run? ⇒ Boolean
Whether dry run.
-
#initialize(params:, dry_run:, is_colored:, target_dir:, is_update_local:, changed_files:) ⇒ EvalContext
constructor
A new instance of EvalContext.
-
#params ⇒ Hash<Symbol, String>
passed from
--params. -
#update_file(pattern, create: false) {|content| ... } ⇒ Object
Update files.
Constructor Details
#initialize(params:, dry_run:, is_colored:, target_dir:, is_update_local:, changed_files:) ⇒ EvalContext
Returns a new instance of EvalContext.
72 73 74 75 76 77 78 79 |
# File 'lib/sashimi_tanpopo/dsl.rb', line 72 def initialize(params:, dry_run:, is_colored:, target_dir:, is_update_local:, changed_files:) @__params__ = params @__dry_run__ = dry_run @__target_dir__ = target_dir @__is_update_local__ = is_update_local @__is_colored__ = is_colored @__changed_files__ = changed_files end |
Instance Method Details
#changed_files ⇒ Hash<String, { before_content: String, after_content: String, mode: String }>
Returns key: file path, value: Hash.
107 108 109 |
# File 'lib/sashimi_tanpopo/dsl.rb', line 107 def changed_files @__changed_files__ end |
#dry_run? ⇒ Boolean
Returns Whether dry run.
117 118 119 |
# File 'lib/sashimi_tanpopo/dsl.rb', line 117 def dry_run? @__dry_run__ end |
#params ⇒ Hash<Symbol, String>
passed from --params
93 94 95 |
# File 'lib/sashimi_tanpopo/dsl.rb', line 93 def params @__params__ end |
#update_file(pattern, create: false) {|content| ... } ⇒ Object
Update files
145 146 147 148 |
# File 'lib/sashimi_tanpopo/dsl.rb', line 145 def update_file(pattern, create: false, &block) update_file_with_glob(pattern, &block) create_new_file(pattern, &block) if create end |