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