Class: Riddle::Configuration::Source

Inherits:
Section
  • Object
show all
Defined in:
lib/riddle/configuration/source.rb

Direct Known Subclasses

SQLSource, TSVSource, XMLSource

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Section

settings

Instance Attribute Details

#nameObject

Returns the value of attribute name


4
5
6
# File 'lib/riddle/configuration/source.rb', line 4

def name
  @name
end

#parentObject

Returns the value of attribute parent


4
5
6
# File 'lib/riddle/configuration/source.rb', line 4

def parent
  @parent
end

#typeObject

Returns the value of attribute type


4
5
6
# File 'lib/riddle/configuration/source.rb', line 4

def type
  @type
end

Instance Method Details

#renderObject

Raises:


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/riddle/configuration/source.rb', line 6

def render
  raise ConfigurationError unless valid?
  
  inherited_name = "#{name}"
  inherited_name << " : #{parent}" if parent
  (
    ["source #{inherited_name}", "{"] +
    settings_body +
    ["}", ""]
  ).join("\n")
end

#valid?Boolean

Returns:

  • (Boolean)

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

def valid?
  !( @name.nil? || @type.nil? )
end