Class: Jekyll::GitHubMetadata::Owner

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/jekyll-github-metadata/owner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner_login) ⇒ Owner

Returns a new instance of Owner


61
62
63
# File 'lib/jekyll-github-metadata/owner.rb', line 61

def initialize()
  @owner_login = 
end

Instance Attribute Details

#owner_loginObject (readonly)

Returns the value of attribute owner_login


59
60
61
# File 'lib/jekyll-github-metadata/owner.rb', line 59

def 
  @owner_login
end

Class Method Details

.content_methodsObject


26
27
28
# File 'lib/jekyll-github-metadata/owner.rb', line 26

def self.content_methods
  @content_methods ||= []
end

.def_hash_delegators(hash, *methods) ⇒ Object

Defines an instance method that delegates to a hash's key

hash - a symbol representing the instance method to delegate to. The

instance method should return a hash or respond to #[]

key - the key to call within the hash method - (optional) the instance method the key should be aliased to.

If not specified, defaults to the hash key

Returns a symbol representing the instance method


17
18
19
20
21
22
23
24
# File 'lib/jekyll-github-metadata/owner.rb', line 17

def self.def_hash_delegators(hash, *methods)
  content_methods.concat(methods)
  methods.each do |method|
    define_method(method) do
      send(hash)[method.to_s]
    end
  end
end

Instance Method Details

#to_hObject Also known as: to_hash


65
66
67
68
# File 'lib/jekyll-github-metadata/owner.rb', line 65

def to_h
  @to_h ||= self.class.content_methods
    .each_with_object({}) { |method, hash| hash[method.to_s] = public_send(method) }
end