Class: DMap::Commands

Inherits:
Object
  • Object
show all
Defined in:
lib/dmap/core.rb

Overview

List available commands here

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



20
21
22
# File 'lib/dmap/core.rb', line 20

def options
  @options
end

Class Method Details

.cmd_newObject

Each command has a cmd_ prefix



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/dmap/core.rb', line 31

def self.cmd_new
  validations = DMap::Validations.list
  associations = DMap::Associations.list
  DMap::Tables.list.each do |k, table|
    properties = DMap::Properties.list[table]
    obj = $new_block.result(binding)

    if DMap::Commands.options['test'].nil? or DMap::Commands.options['test'] == false
      handler = File.new(table + ".rb", "w")
      handler.write(obj)
      handler.close
      p table.camelcase + " saved successfully"
    end

    if DMap::Commands.options['verbose'] == true
      puts obj
    end
  end
end

.exists?(command) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/dmap/core.rb', line 22

def self.exists?(command)
  self.respond_to? "cmd_" + command
end

.optionsObject



26
27
28
# File 'lib/dmap/core.rb', line 26

def self.options
  @options ||= OrderedHash.new
end