Class: Frag::State
- Inherits:
-
Object
- Object
- Frag::State
- Defined in:
- lib/frag/app.rb
Instance Attribute Summary collapse
-
#backup_prefix ⇒ Object
Returns the value of attribute backup_prefix.
-
#backup_suffix ⇒ Object
Returns the value of attribute backup_suffix.
-
#beginning ⇒ Object
Returns the value of attribute beginning.
-
#ending ⇒ Object
Returns the value of attribute ending.
-
#leader ⇒ Object
Returns the value of attribute leader.
-
#trailer ⇒ Object
Returns the value of attribute trailer.
Instance Method Summary collapse
- #begin_line ⇒ Object
- #build_begin_line ⇒ Object
- #build_end_line ⇒ Object
- #end_line ⇒ Object
-
#initialize(beginning, ending, leader, trailer, backup_prefix, backup_suffix) ⇒ State
constructor
A new instance of State.
Constructor Details
#initialize(beginning, ending, leader, trailer, backup_prefix, backup_suffix) ⇒ State
Returns a new instance of State.
190 191 192 193 194 195 196 197 |
# File 'lib/frag/app.rb', line 190 def initialize(beginning, ending, leader, trailer, backup_prefix, backup_suffix) @beginning = beginning @ending = ending @leader = leader @trailer = trailer @backup_prefix = backup_prefix @backup_suffix = backup_suffix end |
Instance Attribute Details
#backup_prefix ⇒ Object
Returns the value of attribute backup_prefix.
199 200 201 |
# File 'lib/frag/app.rb', line 199 def backup_prefix @backup_prefix end |
#backup_suffix ⇒ Object
Returns the value of attribute backup_suffix.
199 200 201 |
# File 'lib/frag/app.rb', line 199 def backup_suffix @backup_suffix end |
#beginning ⇒ Object
Returns the value of attribute beginning.
199 200 201 |
# File 'lib/frag/app.rb', line 199 def beginning @beginning end |
#ending ⇒ Object
Returns the value of attribute ending.
199 200 201 |
# File 'lib/frag/app.rb', line 199 def ending @ending end |
#leader ⇒ Object
Returns the value of attribute leader.
199 200 201 |
# File 'lib/frag/app.rb', line 199 def leader @leader end |
#trailer ⇒ Object
Returns the value of attribute trailer.
199 200 201 |
# File 'lib/frag/app.rb', line 199 def trailer @trailer end |
Instance Method Details
#begin_line ⇒ Object
223 224 225 |
# File 'lib/frag/app.rb', line 223 def begin_line @begin_line ||= build_begin_line end |
#build_begin_line ⇒ Object
231 232 233 234 235 236 |
# File 'lib/frag/app.rb', line 231 def build_begin_line leader = Regexp.escape(@leader) beginning = Regexp.escape(@beginning) trailer = Regexp.escape(@trailer) @begin_line = Regexp.new(['^', leader, beginning, '(.*)', trailer, '$'].reject(&:empty?).join('\\s*')) end |
#build_end_line ⇒ Object
238 239 240 241 242 243 |
# File 'lib/frag/app.rb', line 238 def build_end_line leader = Regexp.escape(@leader) ending = Regexp.escape(@ending) trailer = Regexp.escape(@trailer) @end_line = Regexp.new(['^', leader, ending, trailer, '$'].reject(&:empty?).join('\\s*')) end |
#end_line ⇒ Object
227 228 229 |
# File 'lib/frag/app.rb', line 227 def end_line @end_line ||= build_end_line end |