Class: AppDelegate

Inherits:
Object
  • Object
show all
Defined in:
app/app_delegate.rb

Instance Method Summary collapse

Instance Method Details

#application(application, didFinishLaunchingWithOptions: launchOptions) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'app/app_delegate.rb', line 2

def application(application, didFinishLaunchingWithOptions:launchOptions)
  @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
  @window.rootViewController = UIViewController.alloc.init
  @window.makeKeyAndVisible

  command_line

  true
end

#command_lineObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/app_delegate.rb', line 12

def command_line
  if command = NSProcessInfo.processInfo.environment['dump']
    warn "Executing command line instruction: #{command}"
    AddressBook::AddrBook.new do |ab|
      case command
      when 'people'
        puts BW::JSON.generate(ab.people.map(&:attributes))
      when 'groups'
        puts BW::JSON.generate(ab.groups.map { |g| {name: g.name, members: g.members.map(&:uid) }})
      end
    end
  end
end