Module: RemotePartial

Defined in:
lib/remote_partial.rb,
lib/remote_partial/builder.rb,
lib/remote_partial/partial.rb,
lib/remote_partial/railtie.rb,
lib/remote_partial/version.rb,
lib/remote_partial/exceptions.rb,
lib/remote_partial/yaml_store.rb,
lib/remote_partial/resource_manager.rb

Defined Under Namespace

Classes: Builder, Partial, Railtie, RemotePartialRetrivalError, ResourceManager, YamlStore

Constant Summary collapse

VERSION =
"0.7.3"

Class Method Summary collapse

Class Method Details

.default_rootObject



27
28
29
30
31
32
33
# File 'lib/remote_partial.rb', line 27

def self.default_root
  if defined? Rails
    Rails.root
  else
    raise("You must define a root via: RemotePartial.root = 'some/path' ")
  end
end

.define(args = {}) ⇒ Object



7
8
9
# File 'lib/remote_partial.rb', line 7

def self.define(args = {})
  Builder.build(args)
end

.loggerObject



35
36
37
38
39
40
41
42
# File 'lib/remote_partial.rb', line 35

def self.logger
  if defined? Rails
    Rails.logger
  else
    require 'logger'
    @logger ||= ruby_logger
  end
end

.logger_fileObject



49
50
51
# File 'lib/remote_partial.rb', line 49

def self.logger_file
  @logger_file || STDOUT
end

.logger_file=(path) ⇒ Object



53
54
55
# File 'lib/remote_partial.rb', line 53

def self.logger_file=(path)
  @logger_file = File.expand_path(path, root)
end

.partial_locationObject



11
12
13
14
15
16
17
# File 'lib/remote_partial.rb', line 11

def self.partial_location
  if defined?(Rails)
    File.expand_path('app/views/remote_partials', root)
  else
    File.expand_path('remote_partials', root)
  end
end

.rootObject



19
20
21
# File 'lib/remote_partial.rb', line 19

def self.root
  @root || default_root
end

.root=(path) ⇒ Object



23
24
25
# File 'lib/remote_partial.rb', line 23

def self.root=(path)
  @root = path
end

.ruby_loggerObject



44
45
46
47
# File 'lib/remote_partial.rb', line 44

def self.ruby_logger
  require 'logger'
  Logger.new(logger_file)
end