Class: DbAgile::Command::API

Inherits:
Object
  • Object
show all
Includes:
Environment::Delegator
Defined in:
lib/dbagile/command/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment) ⇒ API

Creates an API instance for a given environment



10
11
12
# File 'lib/dbagile/command/api.rb', line 10

def initialize(environment)
  @environment = environment
end

Instance Attribute Details

#environmentObject (readonly)

Underlying environment



7
8
9
# File 'lib/dbagile/command/api.rb', line 7

def environment
  @environment
end

Instance Method Details

#dataset(name) ⇒ Object

Returns a dataset instance



19
20
21
22
23
# File 'lib/dbagile/command/api.rb', line 19

def dataset(name)
  environment.with_current_connection{|c|
    c.dataset(name)
  }
end

#dupObject

Delegates this api on a environment duplication



43
44
45
# File 'lib/dbagile/command/api.rb', line 43

def dup
  API.new(environment.dup)
end