Class: GitHub::Helper
- Inherits:
-
Object
- Object
- GitHub::Helper
- Includes:
- Singleton
- Defined in:
- lib/github-api-client/base.rb
Overview
Singleton class, that is used globally
Class Method Summary collapse
-
.build_from_yaml(yaml) ⇒ GitHub::User, Array
deprecated
Deprecated.
Nothing uses it, but may come handy later
Class Method Details
.build_from_yaml(yaml) ⇒ GitHub::User, Array
Deprecated.
Nothing uses it, but may come handy later
Recognizing objects retrieved from GitHub, creating new and assigning parameters from YAML
Objects
-
GitHub::User - recognition by key ‘user’
More to be added soon
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/github-api-client/base.rb', line 97 def self.build_from_yaml(yaml) yaml = YAML::load yaml object = case when yaml.has_key?('user') then [GitHub::User, 'user'] when yaml.has_key?('users') then [[GitHub::User], 'users'] end if object.first.class == Array objects = [] yaml[object[1]].each do |single_yaml| o = object.first.first.new o.build single_yaml objects << o end objects else object[0] = object.first.new object.first.build yaml[object[1]] object.first end end |