Sha256: c2d6efb1610fd5f986d38151fa59038c38f7c0595bba191f9cd3cda7274315c3

Contents?: true

Size: 868 Bytes

Versions: 9

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

module Mcoin
  module Command
    # :nodoc:
    module Saveable
      def self.included(base)
        base.class_eval do
          option(:single, :endpoint, '-e',
                 '--endpoint ENDPOINT', URI, 'Database Endpoint')
          option(:single, :database, '-d',
                 '--database NAME', String, 'Database Name')
          option(:single, :username, '-u',
                 '--username USERNAME', String, 'Database Username')
          option(:single, :password, '-p',
                 '--password PASSWORD', String, 'Database Password')
        end
      end

      def save?
        option.endpoint && option.database
      end

      def database
        InfluxDB.new(
          option.endpoint,
          option.database,
          option.username,
          option.password
        )
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mcoin-0.6.1 lib/mcoin/command/ext/saveable.rb
mcoin-0.6.0 lib/mcoin/command/ext/saveable.rb
mcoin-0.5.2 lib/mcoin/command/ext/saveable.rb
mcoin-0.5.1 lib/mcoin/command/ext/saveable.rb
mcoin-0.5.0 lib/mcoin/command/ext/saveable.rb
mcoin-0.4.0 lib/mcoin/command/ext/saveable.rb
mcoin-0.3.0 lib/mcoin/command/ext/saveable.rb
mcoin-0.2.1 lib/mcoin/command/ext/saveable.rb
mcoin-0.2.0 lib/mcoin/command/ext/saveable.rb