Class: Dato::Dump::Dsl::Root

Inherits:
Object
  • Object
show all
Includes:
AddToDataFile, CreateDataFile, CreatePost
Defined in:
lib/dato/dump/dsl/root.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AddToDataFile

#add_to_data_file

Methods included from CreatePost

#create_post

Methods included from CreateDataFile

#create_data_file

Constructor Details

#initialize(config_code, dato, operations) ⇒ Root

Returns a new instance of Root.



20
21
22
23
24
25
26
27
# File 'lib/dato/dump/dsl/root.rb', line 20

def initialize(config_code, dato, operations)
  @dato = dato
  @operations = operations

  # rubocop:disable Security/Eval
  eval(config_code)
  # rubocop:enable Security/Eval
end

Instance Attribute Details

#datoObject (readonly)

Returns the value of attribute dato.



18
19
20
# File 'lib/dato/dump/dsl/root.rb', line 18

def dato
  @dato
end

#operationsObject (readonly)

Returns the value of attribute operations.



18
19
20
# File 'lib/dato/dump/dsl/root.rb', line 18

def operations
  @operations
end

Instance Method Details

#directory(path, &block) ⇒ Object



29
30
31
32
33
34
# File 'lib/dato/dump/dsl/root.rb', line 29

def directory(path, &block)
  operation = Operation::Directory.new(operations, path)
  operations.add operation

  Directory.new(dato, operation, &block)
end