Class: MacAdmin::MCX::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/macadmin/mcx.rb

Overview

Settings

  • class representing the structure of the mcx_settings array

Constant Summary collapse

XML_TAG =
'^<\?xml\sversion="1\.0"\sencoding="UTF-8"\?>'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content, type = :data) ⇒ Settings

Returns a new instance of Settings.



169
170
171
172
173
174
175
# File 'lib/macadmin/mcx.rb', line 169

def initialize(content, type=:data)
  type = :file unless content =~ /#{XML_TAG}/
  plist = CFPropertyList::List.new(type => content)
  native = CFPropertyList.native_types(plist.value)
  @domains = []
  @content = process(native)
end

Instance Attribute Details

#domainsObject (readonly)

Returns the value of attribute domains.



158
159
160
# File 'lib/macadmin/mcx.rb', line 158

def domains
  @domains
end

Class Method Details

.init_with_file(path) ⇒ Object



163
164
165
166
# File 'lib/macadmin/mcx.rb', line 163

def init_with_file(path)
  content = load_plist(path)
  self.new(content)
end