class Github::API::Config

A base class for constructing api configuration

def self.inherited(descendant)

def self.inherited(descendant)
  super
  (@subclasses ||= Set.new) << descendant
  descendant.instance_variable_set('@property_set',
    PropertySet.new(descendant, self.property_set.properties.dup))
end

def self.property(name, options = {})

Other tags:
    Api: - public

Returns:
  • (self) -

Parameters:
  • options (#to_hash) --
  • name (Symbol) --
def self.property(name, options = {})
  self.property_set << Property.new(name, options)
  update_subclasses(name, options)
  self
end

def self.property?(name)

Other tags:
    Api: - public

Returns:
  • (Boolean) -

Parameters:
  • name (Symbol) --
def self.property?(name)
  property_set.include?(name)
end

def self.property_names

def self.property_names
  property_set.properties.map(&:name)
end

def self.update_subclasses(name, options)

def self.update_subclasses(name, options)
  if defined?(@subclasses) && @subclasses
    @subclasses.each { |klass| klass.property(name, options) }
  end
end

def call(&block)

Other tags:
    Api: - private

Returns:
  • (self) -
def call(&block)
  block.call(self) if block_given?
  self
end

def fetch(value = nil)

Other tags:
    Api: - public

Returns:
  • (Hash[Symbol]) -
def fetch(value = nil)
  if value
    self.class.property_set[value]
  else
    self.class.property_set.to_hash
  end
end

def initialize(&block)

def initialize(&block)
  super(&block)
end

def property_names

def property_names
  self.class.property_set.properties.map(&:name)
end