Module: Pod::Specification::DSL::AttributeSupport

Included in:
Pod::Specification::DSL
Defined in:
lib/cocoapods-core/specification/dsl/attribute_support.rb

Overview

This module provides support for storing the runtime information of the Pod::Specification DSL.

Instance Method Summary collapse

Instance Method Details

#attribute(name, options = {}) ⇒ void

This method returns an undefined value.

Defines an attribute for the extended class.

Regular attributes in general support inheritance and multi-platform values, so resolving them for a given specification is not trivial.

Parameters:

  • name (Symbol, String)

    The name of the attribute.

  • options (Hash) (defaults to: {})

    The options used to initialize the attribute.



47
48
49
# File 'lib/cocoapods-core/specification/dsl/attribute_support.rb', line 47

def attribute(name, options = {})
  store_attribute(name, options)
end

#root_attribute(name, options = {}) ⇒ void

This method returns an undefined value.

Defines a root attribute for the extended class.

Root attributes make sense only in root specification, they never are multi-platform, they don't have inheritance, and they never have a default value.

Parameters:

  • name (Symbol, String)

    The name of the attribute.

  • options (Hash) (defaults to: {})

    The options used to initialize the attribute.



28
29
30
31
32
# File 'lib/cocoapods-core/specification/dsl/attribute_support.rb', line 28

def root_attribute(name, options = {})
  options[:root_only] = true
  options[:multi_platform] = false
  store_attribute(name, options)
end

#store_attribute(name, options) ⇒ void (private)

This method returns an undefined value.

Creates an attribute with the given name and options and stores it in the Pod::Specification::DSL.attributes hash.

Parameters:

  • name (String)

    The name of the attribute.

  • options (Hash)

    The options used to initialize the attribute.



66
67
68
69
70
# File 'lib/cocoapods-core/specification/dsl/attribute_support.rb', line 66

def store_attribute(name, options)
  attr = Attribute.new(name, options)
  @attributes ||= {}
  @attributes[name] = attr
end