Class: Github::API::Config::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/github_api2/api/config/property.rb

Overview

Property objects provide an interface for configuration options

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ Property

Returns a new instance of Property.



14
15
16
17
18
19
# File 'lib/github_api2/api/config/property.rb', line 14

def initialize(name, options)
  @name = name
  @default = options.fetch(:default, nil)
  @required = options.fetch(:required, nil)
  @options = options
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



11
12
13
# File 'lib/github_api2/api/config/property.rb', line 11

def default
  @default
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/github_api2/api/config/property.rb', line 10

def name
  @name
end

#requiredObject (readonly)

Returns the value of attribute required.



12
13
14
# File 'lib/github_api2/api/config/property.rb', line 12

def required
  @required
end

Instance Method Details

#define_accessor_methods(properties) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
25
# File 'lib/github_api2/api/config/property.rb', line 22

def define_accessor_methods(properties)
  properties.define_reader_method(self, self.name, :public)
  properties.define_writer_method(self, "#{self.name}=", :public)
end