Object
Class responsible for storing configuration properties
Initialize an PropertySet
@param [Object] parent @param [Set] properties
@return [undefined]
@api private
# File lib/github_api/api/config/property_set.rb, line 22 def initialize(parent = nil, properties = Set.new) @parent = parent @properties = properties @map = {} end
Adds property to the set
@example
properties_set << property
@param [Property] property
@return [self]
@api public
# File lib/github_api/api/config/property_set.rb, line 53 def <<(property) properties << property update_map(property.name, property.default) property.define_accessor_methods(self) self end
Access property by name
@api public
# File lib/github_api/api/config/property_set.rb, line 63 def [](name) @map[name] end
Set property value by name
@api public
# File lib/github_api/api/config/property_set.rb, line 71 def []=(name, property) update_map(name, property) end
@api private
# File lib/github_api/api/config/property_set.rb, line 101 def define_reader_method(property, method_name, visibility) property_set = self parent.send(:define_method, method_name) { property_set[property.name] } parent.send(visibility, method_name) end
@api private
# File lib/github_api/api/config/property_set.rb, line 108 def define_writer_method(property, method_name, visibility) property_set = self parent.send(:define_method, method_name) do |value| property_set[property.name]= value end parent.send(visibility, method_name) end
Iterate over properties
@yield [property]
@yieldparam [Property] property
@return [self]
@api public
# File lib/github_api/api/config/property_set.rb, line 37 def each return to_enum unless block_given? @map.each { |name, property| yield property if name.is_a?(Symbol) } self end
Check if properties exist
@api public
# File lib/github_api/api/config/property_set.rb, line 96 def empty? @map.empty? end
Generated with the Darkfish Rdoc Generator 2.