Class: Jeny::File::WithBlocks

Inherits:
Jeny::File show all
Defined in:
lib/jeny/file/with_blocks.rb

Instance Attribute Summary

Attributes inherited from Jeny::File

#config, #path

Instance Method Summary collapse

Methods inherited from Jeny::File

#initialize, #rewrite

Constructor Details

This class inherits a constructor from Jeny::File

Instance Method Details

#has_jeny_blocks?Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
# File 'lib/jeny/file/with_blocks.rb', line 5

def has_jeny_blocks?
  !jeny_blocks.empty?
rescue Exception => ex
  puts "WARN: #{path} skipped: #{ex.message}"
  false
end

#instantiate(data) ⇒ Object



16
17
18
19
# File 'lib/jeny/file/with_blocks.rb', line 16

def instantiate(data)
  return path.read unless has_jeny_blocks?
  _instantiate(data, path.readlines, 0, jeny_blocks, []).join("")
end

#jeny_blocksObject



12
13
14
# File 'lib/jeny/file/with_blocks.rb', line 12

def jeny_blocks
  @jeny_blocks ||= _parse_jeny_blocks(path.readlines, 0, [])
end