Sha256: e286f6b4c4d3c69ff4d70846cfc184eeba014d9fb37af2ebe42d2ddc8782ffa8

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

require 'xiv_lodestone/lodestone_helper'
require 'oj'

module XIVLodestone
  class MountList
    attr_reader :list

    def initialize(mount_path)
      @list = Array.new
      parse_mount(mount_path)
    end
    # Uses gem Oj to dump MountList to JSON
    def to_json()
      Oj.dump(@list)
    end
    #### Private Methods ####
    def parse_mount(mount_path)
      mount_path.each do |mount|
        @list.push(Mount.new(mount['title'],
          mount.at_xpath('img')['src']))
      end
    end

    private :parse_mount

    class Mount
      attr_reader :name, :icon_url

      def initialize(name, icon_url)
        @name = name.split.map(&:capitalize)*' '
        @icon_url = icon_url
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xiv_lodestone-0.0.4 lib/xiv_lodestone/lodestone_character_mount.rb