Class: Source
Overview
Class Source represents structure of source
source = Source.new
source.name # => String
source.code # => String
source.logo_url # => String
source.logo_sm_url # => String
source.hidden # => Boolean
source.from_array(array) # => Array of Source objects
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#hidden ⇒ Object
Returns the value of attribute hidden.
-
#logo_sm_url ⇒ Object
Returns the value of attribute logo_sm_url.
-
#logo_url ⇒ Object
Returns the value of attribute logo_url.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
-
.from_array(array) ⇒ Object
Method
from_array
returns array of sources(create from json).
Methods inherited from Struct
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code
12 13 14 |
# File 'lib/models/source.rb', line 12 def code @code end |
#hidden ⇒ Object
Returns the value of attribute hidden
12 13 14 |
# File 'lib/models/source.rb', line 12 def hidden @hidden end |
#logo_sm_url ⇒ Object
Returns the value of attribute logo_sm_url
12 13 14 |
# File 'lib/models/source.rb', line 12 def logo_sm_url @logo_sm_url end |
#logo_url ⇒ Object
Returns the value of attribute logo_url
12 13 14 |
# File 'lib/models/source.rb', line 12 def logo_url @logo_url end |
#name ⇒ Object
Returns the value of attribute name
12 13 14 |
# File 'lib/models/source.rb', line 12 def name @name end |
Class Method Details
.from_array(array) ⇒ Object
Method from_array
returns array of sources(create from json). Takes value of array objects as json parameter array.
Example:
Source.from_array([...array of JSON objects...]) # => Array of Source
22 23 24 25 26 |
# File 'lib/models/source.rb', line 22 def self.from_array(array) array.collect do |element| Source.new(element) end end |