Sha256: 52dfda58241ea055380d0b42be5a8412b66f5408f6438a6ff5e9ae4788838698

Contents?: true

Size: 621 Bytes

Versions: 3

Compression:

Stored size: 621 Bytes

Contents

module R2RDF
  module Reader
    module Output
      def output(string, options={},append=false)
        options[:type] = [:string] unless options[:type]
        base = options[:file_base]
        name = options[:file_name]
        types = Array(options[:type])

        if types.include? :print
          puts string
        end

        if types.include? :file
          raise "no file specified output" unless name

          method = append ? 'a' : 'w'
          open("#{base}#{name}", method) { |f| f.write str }
        end

        if types.include? :string
          string
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bio-publisci-0.0.6 lib/bio-publisci/output.rb
bio-publisci-0.0.5 lib/bio-publisci/output.rb
bio-publisci-0.0.4 lib/bio-publisci/output.rb