Class: FreeScrape::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/free_scrape/category.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Category

Creates a new Category object with the specified name.



13
14
15
16
# File 'lib/free_scrape/category.rb', line 13

def initialize(name)
  @name = name
  @metadata = {}
end

Instance Attribute Details

#metadataObject (readonly)

Metadata associated with the category



8
9
10
# File 'lib/free_scrape/category.rb', line 8

def 
  @metadata
end

#nameObject (readonly)

Name of the category



5
6
7
# File 'lib/free_scrape/category.rb', line 5

def name
  @name
end

Instance Method Details

#[](name) ⇒ Object

Returns the metadata with the specified name.



21
22
23
# File 'lib/free_scrape/category.rb', line 21

def [](name)
  @metadata[name]
end

#to_sObject

Returns the name of the category in String form.



28
29
30
# File 'lib/free_scrape/category.rb', line 28

def to_s
  @name.to_s
end