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.



6
7
8
# File 'lib/riddle/configuration/source.rb', line 6

def name
  @name
end

#parentObject

Returns the value of attribute parent.



6
7
8
# File 'lib/riddle/configuration/source.rb', line 6

def parent
  @parent
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/riddle/configuration/source.rb', line 6

def type
  @type
end

Instance Method Details

#renderObject

Raises:



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

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)


20
21
22
# File 'lib/riddle/configuration/source.rb', line 20

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