class Jekyll::GitHubMetadata::Owner
Attributes
owner_login[R]
Public Class Methods
content_methods()
click to toggle source
# File lib/jekyll-github-metadata/owner.rb, line 26 def self.content_methods @content_methods ||= [] end
def_hash_delegators(hash, *methods)
click to toggle source
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
# 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
new(owner_login)
click to toggle source
# File lib/jekyll-github-metadata/owner.rb, line 61 def initialize(owner_login) @owner_login = owner_login end
Public Instance Methods
to_h()
click to toggle source
# 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
Also aliased as: to_hash
Private Instance Methods
owner_info()
click to toggle source
# File lib/jekyll-github-metadata/owner.rb, line 78 def owner_info @owner_info ||= begin Value.new( "owner", proc do |c| (c.organization(owner_login) || c.user(owner_login) || {}).to_h end ).render || {} end end