Sha256: a0cb66bea08bf84895f76de74c01fed378e8cd9d87e01dc0609039f4e59bbf90

Contents?: true

Size: 866 Bytes

Versions: 84

Compression:

Stored size: 866 Bytes

Contents

module Bhf

  class Settings

    def initialize(options)
      @options = options
    end

    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

    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

    def find_platform(platform_name, current_account = nil)
      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

  end

end

Version data entries

84 entries across 84 versions & 1 rubygems

Version Path
bhf-0.4.36 lib/bhf/settings.rb
bhf-0.4.35 lib/bhf/settings.rb
bhf-0.4.34 lib/bhf/settings.rb
bhf-0.4.33 lib/bhf/settings.rb
bhf-0.4.32 lib/bhf/settings.rb
bhf-0.4.31 lib/bhf/settings.rb
bhf-0.4.30 lib/bhf/settings.rb
bhf-0.4.25 lib/bhf/settings.rb
bhf-0.4.24 lib/bhf/settings.rb
bhf-0.4.23 lib/bhf/settings.rb
bhf-0.4.22 lib/bhf/settings.rb
bhf-0.4.21 lib/bhf/settings.rb
bhf-0.4.20 lib/bhf/settings.rb
bhf-0.4.19 lib/bhf/settings.rb
bhf-0.4.18 lib/bhf/settings.rb
bhf-0.4.17 lib/bhf/settings.rb
bhf-0.4.16 lib/bhf/settings.rb
bhf-0.4.15 lib/bhf/settings.rb
bhf-0.4.14 lib/bhf/settings.rb
bhf-0.4.13 lib/bhf/settings.rb