Class: Hatenablog::Category

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.load_xml(xml) ⇒ Hatenablog::Category

Create a new blog categories from a XML string.

Parameters:

  • xml (String)

    XML string representation

Returns:



9
10
11
# File 'lib/hatenablog/category.rb', line 9

def self.load_xml(xml)
  Hatenablog::Category.new(xml)
end

Instance Method Details

#categoriesArray

Returns:

  • (Array)


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

def categories
  @categories.dup
end

#each(&block) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/hatenablog/category.rb', line 18

def each(&block)
  return enum_for unless block_given?

  @categories.each do |category|
    # @type var block: ^(String) -> void
    block.call(category)
  end
end

#fixed?Boolean

If fixed, only categories in this categories can be used for a blog entry.

Returns:

  • (Boolean)


29
30
31
# File 'lib/hatenablog/category.rb', line 29

def fixed?
  @fixed == 'yes'
end