Class: RailsConnector::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_connector/configuration.rb

Constant Summary collapse

DEFAULT_MODE =
:live

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.blob_cache_dirObject

there are three available modes for the rails connector: live (show released contents only), preview (show edited contents) editor (show edited contents and editor interface (e.g. edit markers)) Default mode is live.



18
19
20
# File 'lib/rails_connector/configuration.rb', line 18

def blob_cache_dir
  @blob_cache_dir
end

.choose_homepage_callbackObject

there are three available modes for the rails connector: live (show released contents only), preview (show edited contents) editor (show edited contents and editor interface (e.g. edit markers)) Default mode is live.



18
19
20
# File 'lib/rails_connector/configuration.rb', line 18

def choose_homepage_callback
  @choose_homepage_callback
end

.search_optionsObject

default options for SearchRequest



26
27
28
# File 'lib/rails_connector/configuration.rb', line 26

def search_options
  @search_options || local_config_file["search"].symbolize_keys
end

Class Method Details

.choose_homepage(&block) ⇒ Object

Configure a callback to be invoked when the rails connector delivers the homepage. The given callback will receive the rack env and must return an Obj to be used as the homepage. If no callback is configured, Obj.homepage will be used as the default.



97
98
99
# File 'lib/rails_connector/configuration.rb', line 97

def choose_homepage(&block)
  self.choose_homepage_callback = block
end

.instance_name=(name) ⇒ Object

Configures your CMS instance name.

Example call as to be used in rails_connector.rb:

RailsConnector::Configuration.instance_name = 'internet'


65
66
67
# File 'lib/rails_connector/configuration.rb', line 65

def instance_name=(name)
  RailsConnector::CmsBaseModel.instance_name = name if RailsConnector.platform_fiona?
end

.modeObject

there are three available modes for the rails connector: live (show released contents only), preview (show edited contents) editor (show edited contents and editor interface (e.g. edit markers)) Default mode is live.



48
49
50
# File 'lib/rails_connector/configuration.rb', line 48

def mode
  @mode || DEFAULT_MODE
end

.mode=(new_mode) ⇒ Object

Raises:

  • (ArgumentError)


35
36
37
38
39
40
# File 'lib/rails_connector/configuration.rb', line 35

def mode=(new_mode)
  new_mode = new_mode.to_sym
  raise ArgumentError, "Unknown Mode #{new_mode}" unless %i(editor preview live).include?(new_mode)

  @mode = new_mode
end