Sha256: 99c42b7128660ba35633a339a0458f6698cf171e04adcb2dd8b5bf39fa53b0f7

Contents?: true

Size: 701 Bytes

Versions: 8

Compression:

Stored size: 701 Bytes

Contents

module PubliSci
  module DSL
    class Configuration
      def self.defaults
        {
          output: :generate_n3,
          abbreviate: false,
          repository: :in_memory,
          repository_url: 'http://localhost:8080/'
        }
      end

      defaults.keys.each{|k|
        default = defaults[k]
        define_method(k) do |input=nil|
          var = instance_variable_get :"@#{k}"
          if var
            var
          else
            instance_variable_set :"@#{k}", default
          end

          if input
            instance_variable_set :"@#{k}", input
          end

          instance_variable_get :"@#{k}"
        end

        attr_writer k
      }
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
publisci-0.1.6 lib/publisci/dsl/config.rb
publisci-0.1.5 lib/publisci/dsl/config.rb
publisci-0.1.4 lib/publisci/dsl/config.rb
publisci-0.1.3 lib/publisci/dsl/config.rb
publisci-0.1.2 lib/bio-publisci/dsl/config.rb
bio-publisci-0.1.0 lib/bio-publisci/dsl/config.rb
bio-publisci-0.0.8 lib/bio-publisci/dsl/config.rb
bio-publisci-0.0.7 lib/bio-publisci/dsl/config.rb