module Pod::Specification::DSL::AttributeSupport

This module provides support for storing the runtime information of the {Specification} DSL.

Public Instance Methods

attribute(name, options = {}) click to toggle source

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.

@param [Symbol, String] name

The name of the attribute.

@param [Hash] options

The options used to initialize the attribute.

@return [void]

# File lib/cocoapods-core/specification/dsl/attribute_support.rb, line 47
def attribute(name, options = {})
  store_attribute(name, options)
end
root_attribute(name, options = {}) click to toggle source

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.

@param [Symbol, String] name

The name of the attribute.

@param [Hash] options

The options used to initialize the attribute.

@return [void]

# 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) click to toggle source

Creates an attribute with the given name and options and stores it in the {DSL.attributes} hash.

@param [String] name

The name of the attribute.

@param [Hash] options

The options used to initialize the attribute.

@return [void]

@visibility private

# 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