Sha256: e9656733292a1da1cc039540a7a703c6442a6fc94fb12c7bd66c037cbae4e11b

Contents?: true

Size: 853 Bytes

Versions: 3

Compression:

Stored size: 853 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|
        if page.is_a?(String)
          page = {page => nil}
        end
        if selected_page == page.keys[0]
          return page.values.flatten
        end
      end
      nil
    end

    def find_platform(platform_name)
      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

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bhf-0.1.6 lib/bhf/settings.rb
bhf-0.1.5 lib/bhf/settings.rb
bhf-0.1.4 lib/bhf/settings.rb