Class: Bhf::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/bhf/settings.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Settings

Returns a new instance of Settings.



5
6
7
# File 'lib/bhf/settings.rb', line 5

def initialize(options)
  @options = 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
# File 'lib/bhf/settings.rb', line 29

def find_platform(platform_name,  = nil)
  pages.each do |page|
    content_for_page(page).each do |platform|
      bhf_platform = Bhf::Platform.new(platform, page, )
      return bhf_platform if bhf_platform.name == platform_name
    end
  end
end

#pagesObject



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