class Riddle::Configuration::Index

Attributes

parent[RW]
sources[RW]

Public Class Methods

new(name, *sources) click to toggle source
# File lib/riddle/configuration/index.rb, line 13
def initialize(name, *sources)
  @name                     = name
  @sources                  = sources

  initialize_settings
end
settings() click to toggle source
# File lib/riddle/configuration/index.rb, line 7
def self.settings
  Riddle::Configuration::IndexSettings.settings + [:source]
end

Public Instance Methods

render() click to toggle source
# File lib/riddle/configuration/index.rb, line 24
def render
  raise ConfigurationError, "#{@name} #{@sources.inspect} #{@path} #{@parent}" unless valid?

  inherited_name = "#{name}"
  inherited_name << " : #{parent}" if parent
  (
    @sources.collect { |s| s.render } +
    ["index #{inherited_name}", "{"] +
    settings_body +
    ["}", ""]
  ).join("\n")
end
source() click to toggle source
# File lib/riddle/configuration/index.rb, line 20
def source
  @sources.collect { |s| s.name }
end
valid?() click to toggle source
# File lib/riddle/configuration/index.rb, line 37
def valid?
  (!@name.nil?) && (!( @sources.length == 0 || @path.nil? ) || !@parent.nil?)
end