Sha256: 507780e09ca587e3398231e9c55f528d6d0e2ac55962c77a836daef3c9f7b3bd

Contents?: true

Size: 903 Bytes

Versions: 11

Compression:

Stored size: 903 Bytes

Contents

module Riddle
  class Configuration
    class Section
      class << self
        attr_accessor :settings
      end
      
      settings = []
      
      def valid?
        true
      end
      
      private
      
      def settings_body
        self.class.settings.select { |setting|
          !send(setting).nil?
        }.collect { |setting|
          if send(setting) == ""
            conf = "  #{setting} = "
          else
            conf = setting_to_array(setting).collect { |set|
              "  #{setting} = #{set}"  
            }
          end
          conf.length == 0 ? nil : conf
        }.flatten.compact
      end
      
      def setting_to_array(setting)
        value = send(setting)
        case value
        when Array      then value
        when TrueClass  then [1]
        when FalseClass then [0]
        else
          [value]
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
dpickett-thinking-sphinx-1.1.23 vendor/riddle/lib/riddle/configuration/section.rb
ebeigarts-thinking-sphinx-1.1.21 vendor/riddle/lib/riddle/configuration/section.rb
ebeigarts-thinking-sphinx-1.1.22 vendor/riddle/lib/riddle/configuration/section.rb
freelancing-god-thinking-sphinx-1.1.18 vendor/riddle/lib/riddle/configuration/section.rb
freelancing-god-thinking-sphinx-1.1.19 vendor/riddle/lib/riddle/configuration/section.rb
freelancing-god-thinking-sphinx-1.1.20 vendor/riddle/lib/riddle/configuration/section.rb
freelancing-god-thinking-sphinx-1.1.21 vendor/riddle/lib/riddle/configuration/section.rb
freelancing-god-thinking-sphinx-1.1.22 vendor/riddle/lib/riddle/configuration/section.rb
freelancing-god-thinking-sphinx-1.1.23 vendor/riddle/lib/riddle/configuration/section.rb
freelancing-god-thinking-sphinx-1.1.24 vendor/riddle/lib/riddle/configuration/section.rb
initforthe-thinking-sphinx-1.1.21 vendor/riddle/lib/riddle/configuration/section.rb