Class: Pandora::Models::Framework

Inherits:
Object
  • Object
show all
Defined in:
lib/pandora/models/framework.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, project_path, dependencies) ⇒ Framework

Initializes the framework from a YML hash.

Parameters:

  • framework (String)

    name.

  • project (String)

    path.

  • framework ([String])

    dependencies list.



19
20
21
22
23
24
# File 'lib/pandora/models/framework.rb', line 19

def initialize(name, project_path, dependencies)
  @name = name
  @project_path = project_path
  raise "Wrong project path. It should be a .xcodeproj" unless @project_path.include?(".xcodeproj")
  @dependencies = dependencies
end

Instance Attribute Details

#dependenciesObject (readonly)

Array of dependencies (names)



12
13
14
# File 'lib/pandora/models/framework.rb', line 12

def dependencies
  @dependencies
end

#nameObject (readonly)

Framework name



6
7
8
# File 'lib/pandora/models/framework.rb', line 6

def name
  @name
end

#project_pathObject (readonly)

Project path (.xcodeproj)



9
10
11
# File 'lib/pandora/models/framework.rb', line 9

def project_path
  @project_path
end

Class Method Details

.from_yml(name, yml) ⇒ Framework

Initializes a Framework from a YAML dictionary.

Parameters:

  • framework (String)

    name.

  • dictionary (Hash)

    that represents the framework

Returns:

Raises:

  • (StandardError)

    if the dictionary doesn’t include a project_path



31
32
33
34
35
36
37
# File 'lib/pandora/models/framework.rb', line 31

def self.from_yml(name, yml)
  project_path = yml["project_path"]
  raise "Project not specified for framework #{name}" unless project_path
  dependencies = yml["dependencies"]
  dependencies ||= []
  Framework.new(name, project_path, dependencies)
end