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.6.5 lib/bhf/settings.rb
bhf-0.6.4 lib/bhf/settings.rb
bhf-0.6.3 lib/bhf/settings.rb
bhf-0.6.2 lib/bhf/settings.rb
bhf-0.6.1 lib/bhf/settings.rb
bhf-0.6.0 lib/bhf/settings.rb
bhf-0.5.13 lib/bhf/settings.rb
bhf-0.5.12 lib/bhf/settings.rb
bhf-0.5.11 lib/bhf/settings.rb
bhf-0.5.10 lib/bhf/settings.rb
bhf-0.5.9 lib/bhf/settings.rb
bhf-0.5.8 lib/bhf/settings.rb
bhf-0.5.7 lib/bhf/settings.rb
bhf-0.5.6 lib/bhf/settings.rb
bhf-0.5.5 lib/bhf/settings.rb
bhf-0.5.4 lib/bhf/settings.rb
bhf-0.5.3 lib/bhf/settings.rb
bhf-0.5.2 lib/bhf/settings.rb
bhf-0.5.1 lib/bhf/settings.rb
bhf-0.5.0 lib/bhf/settings.rb