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.
182 183 184 185 186 187 188 189 |
# File 'lib/frag/app.rb', line 182 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.
191 192 193 |
# File 'lib/frag/app.rb', line 191 def backup_prefix @backup_prefix end |
#backup_suffix ⇒ Object
Returns the value of attribute backup_suffix.
191 192 193 |
# File 'lib/frag/app.rb', line 191 def backup_suffix @backup_suffix end |
#beginning ⇒ Object
Returns the value of attribute beginning.
191 192 193 |
# File 'lib/frag/app.rb', line 191 def beginning @beginning end |
#ending ⇒ Object
Returns the value of attribute ending.
191 192 193 |
# File 'lib/frag/app.rb', line 191 def ending @ending end |
#leader ⇒ Object
Returns the value of attribute leader.
191 192 193 |
# File 'lib/frag/app.rb', line 191 def leader @leader end |
#trailer ⇒ Object
Returns the value of attribute trailer.
191 192 193 |
# File 'lib/frag/app.rb', line 191 def trailer @trailer end |
Instance Method Details
#begin_line ⇒ Object
215 216 217 |
# File 'lib/frag/app.rb', line 215 def begin_line @begin_line ||= build_begin_line end |
#build_begin_line ⇒ Object
223 224 225 226 227 228 |
# File 'lib/frag/app.rb', line 223 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
230 231 232 233 234 235 |
# File 'lib/frag/app.rb', line 230 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
219 220 221 |
# File 'lib/frag/app.rb', line 219 def end_line @end_line ||= build_end_line end |