Sha256: b950078659114dc7db4e7ca096055a39ad35e26cc010e4d53ee4d83ef599c1f9

Contents?: true

Size: 528 Bytes

Versions: 9

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

module Riddle
  class Configuration
    class Source < Riddle::Configuration::Section
      attr_accessor :name, :parent, :type

      def render
        raise ConfigurationError unless valid?

        inherited_name = "#{name}"
        inherited_name += " : #{parent}" if parent
        (
          ["source #{inherited_name}", "{"] +
          settings_body +
          ["}", ""]
        ).join("\n")
      end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
riddle-2.4.3 lib/riddle/configuration/source.rb
riddle-2.4.2 lib/riddle/configuration/source.rb
riddle-2.4.1 lib/riddle/configuration/source.rb
riddle-2.4.0 lib/riddle/configuration/source.rb
riddle-2.3.2 lib/riddle/configuration/source.rb
riddle-2.3.1 lib/riddle/configuration/source.rb
riddle-2.3.0 lib/riddle/configuration/source.rb
riddle-2.2.2 lib/riddle/configuration/source.rb
riddle-2.2.1 lib/riddle/configuration/source.rb