Class: Embargo

Inherits:
Cuba show all
Defined in:
lib/embargo.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.app_directoryObject



32
33
34
# File 'lib/embargo.rb', line 32

def self.app_directory
  @@app_directory ||= Dir.pwd
end

.require_file(file_name) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/embargo.rb', line 36

def self.require_file(file_name)
  project_file_name = Embargo.app_directory + "/" + file_name
  project_file_exists = File.exist?(project_file_name)

  if project_file_exists
    require project_file_name
  else
    embargo_file_name = Embargo.directory + "/" + file_name
    embargo_file_exists = File.exist?(embargo_file_name)
    if embargo_file_exists
      require embargo_file_name
    end
  end
end

Instance Method Details

#content_for(key, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/embargo.rb', line 19

def content_for(key, &block)
  if block
    @_content_for ||= {}
    buf_was = @haml_buffer.buffer
    @haml_buffer.buffer = ''
    yield
    @_content_for[key] = @haml_buffer.buffer
    @haml_buffer.buffer = buf_was
  elsif @_content_for
    @_content_for[key]
  end
end