Class: Bhf::Settings
- Inherits:
-
Object
- Object
- Bhf::Settings
- Defined in:
- lib/bhf/settings.rb
Instance Method Summary collapse
- #content_for_page(selected_page) ⇒ Object
- #find_platform(platform_name, current_account = nil) ⇒ Object
-
#initialize(options) ⇒ Settings
constructor
A new instance of Settings.
- #pages ⇒ Object
Constructor Details
#initialize(options) ⇒ Settings
Returns a new instance of Settings.
5 6 7 |
# File 'lib/bhf/settings.rb', line 5 def initialize() @options = end |
Instance Method Details
#content_for_page(selected_page) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bhf/settings.rb', line 18 def content_for_page(selected_page) @options['pages'].each do |page| page = {page => nil} if page.is_a?(String) if selected_page == page.keys[0] return page.values.flatten end end nil end |
#find_platform(platform_name, current_account = nil) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/bhf/settings.rb', line 29 def find_platform(platform_name, current_account = nil) # TODO: error for platforms whit the same name pages.each do |page| content_for_page(page).each do |platform| bhf_platform = Bhf::Platform.new(platform, page, current_account) return bhf_platform if bhf_platform.name == platform_name end end end |
#pages ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/bhf/settings.rb', line 9 def pages @options['pages'].each_with_object([]) do |page, obj| if page.is_a?(String) page = {page => nil} end obj << page.keys[0] end end |