Sha256: 8c516ec343acd52b873aa785ab679187003b69f1b73b1fe2ea478e8d7cc25edc

Contents?: true

Size: 853 Bytes

Versions: 3

Compression:

Stored size: 853 Bytes

Contents

module Gnomika
  ##
  # A quote category. Has many subcategories
  class Category
    attr_reader :subcategories, :name

    ##
    # @param category_name Category name
    # @param subcategories Array of subcategories included in category. Is an empty array, if omitted
    def initialize(category_name, subcategories: [])
      @name = category_name
      @subcategories = subcategories
    end
  end

  ##
  # A quote subcategory. Has a name and a URL to the quotes page.
  class Subcategory
    attr_reader :name, :url, :quotes

    ##
    # @param subcategory_name Subcategory name
    # @param subcategory_url URL containing the quotes of this subcategory
    def initialize(subcategory_name, subcategory_url)
      @name = subcategory_name
      @url = subcategory_url
    end

    def ==(other)
      self.name == other.name
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gnomikologikon-fortune-1.0.3 lib/gnomikologikon/category.rb
gnomikologikon-fortune-1.0.2 lib/gnomikologikon/category.rb
gnomikologikon-fortune-1.0.1 lib/gnomikologikon/category.rb