Class: VanishingVision::Core
- Inherits:
-
Object
- Object
- VanishingVision::Core
- Defined in:
- lib/vanishing_vision/core.rb
Instance Method Summary collapse
-
#initialize(source) ⇒ Core
constructor
A new instance of Core.
- #vanish ⇒ Object
Constructor Details
#initialize(source) ⇒ Core
3 4 5 |
# File 'lib/vanishing_vision/core.rb', line 3 def initialize(source) @source = source end |
Instance Method Details
#vanish ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/vanishing_vision/core.rb', line 7 def vanish begin lines = @source.dup.split("\n") rescue return # For example, it occurs in UTF-32[BUG] end lines.map!(&:rstrip) lines = remove_leading_blank_lines(lines) lines = remove_leading_blank_lines(lines.reverse).reverse lines.join("\n") << "\n" end |