Class: MacAdmin::Computer

Inherits:
DSLocalRecord show all
Defined in:
lib/macadmin/dslocal/computer.rb

Overview

Computer

  • creates and manages Mac OS X Computer records

  • params: :name, :realname, :en_address

Constant Summary

Constants inherited from DSLocalRecord

DSLocalRecord::DSLOCAL_ROOT

Constants included from Common

MacAdmin::Common::MAC_OS_X_PRODUCT_VERSION

Instance Attribute Summary

Attributes inherited from DSLocalRecord

#composite, #data, #file, #node, #real, #record

Instance Method Summary collapse

Methods inherited from DSLocalRecord

#[], #[]=, #create, #destroy, #diff, #eql?, #exists?, init_with_file, #initialize

Methods included from MCX

#has_mcx?, #mcx_delete, #mcx_export, #mcx_import, #pretty_mcx

Methods included from Common

#get_primary_mac_address, #load_plist, #restart_directoryservice

Constructor Details

This class inherits a constructor from MacAdmin::DSLocalRecord

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MacAdmin::DSLocalRecord

Instance Method Details

#defaults(data) ⇒ Object

Handle required but unspecified record attributes

  • generates missing attributes

  • changes are merged into the composite record



11
12
13
14
15
16
17
18
# File 'lib/macadmin/dslocal/computer.rb', line 11

def defaults(data)
  mac_address = get_primary_mac_address
  defaults = {
    'realname'   => ["#{data['name'].first.capitalize}"],
    'en_address' => [mac_address]
  }
  super defaults.merge(data)
end