Module: ActiveMocker::Config

Extended by:
Config
Included in:
Base, Config
Defined in:
lib/active_mocker/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#active_hash_as_baseObject

Returns the value of attribute active_hash_as_base.



6
7
8
# File 'lib/active_mocker/config.rb', line 6

def active_hash_as_base
  @active_hash_as_base
end

#mass_assignmentObject

Returns the value of attribute mass_assignment.



6
7
8
# File 'lib/active_mocker/config.rb', line 6

def mass_assignment
  @mass_assignment
end

#model_dirObject

Returns the value of attribute model_dir.



6
7
8
# File 'lib/active_mocker/config.rb', line 6

def model_dir
  @model_dir
end

#model_file_readerObject

Returns the value of attribute model_file_reader.



6
7
8
# File 'lib/active_mocker/config.rb', line 6

def model_file_reader
  @model_file_reader
end

#model_methodsObject

Returns the value of attribute model_methods.



6
7
8
# File 'lib/active_mocker/config.rb', line 6

def model_methods
  @model_methods
end

#model_relationshipsObject

Returns the value of attribute model_relationships.



6
7
8
# File 'lib/active_mocker/config.rb', line 6

def model_relationships
  @model_relationships
end

#schema_attributesObject

Returns the value of attribute schema_attributes.



6
7
8
# File 'lib/active_mocker/config.rb', line 6

def schema_attributes
  @schema_attributes
end

#schema_fileObject

Returns the value of attribute schema_file.



6
7
8
# File 'lib/active_mocker/config.rb', line 6

def schema_file
  @schema_file
end

#schema_file_readerObject

Returns the value of attribute schema_file_reader.



6
7
8
# File 'lib/active_mocker/config.rb', line 6

def schema_file_reader
  @schema_file_reader
end

Instance Method Details

#check_required_settingsObject



33
34
35
36
# File 'lib/active_mocker/config.rb', line 33

def check_required_settings
  raise 'schema_file must be specified'if schema_file.nil?
  raise 'model_dir must be specified'if model_dir.nil?
end

#config {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



16
17
18
19
20
# File 'lib/active_mocker/config.rb', line 16

def config
  @@first_load ||= reload_default
  yield self
  check_required_settings
end

#log_level=(level) ⇒ Object



38
39
40
# File 'lib/active_mocker/config.rb', line 38

def log_level=(level)
  Logger_.level = level
end

#reload_defaultObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/active_mocker/config.rb', line 22

def reload_default
  @schema_file         = nil
  @model_dir           = nil
  @active_hash_as_base = false
  @schema_attributes   = true
  @model_relationships = true
  @model_methods       = true
  @mass_assignment     = true
  @log_level           = Logger::WARN
end