Class: Charu::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/Charu/ChangeLogMemo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCategory

Returns a new instance of Category.



8
9
10
11
12
13
14
15
# File 'lib/Charu/ChangeLogMemo.rb', line 8

def initialize()
  @category = []
  @config = Charu::Config.new()

  # プライベートの設定
  # 基本は全部プライベート
  @private_category = false
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



7
8
9
# File 'lib/Charu/ChangeLogMemo.rb', line 7

def category
  @category
end

Instance Method Details

#add(title_source) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/Charu/ChangeLogMemo.rb', line 17

def add(title_source)
  if title_source == nil then
    title_source = ""
  end

  title_source.scan(/\[(.*?)\]:/).each{|category|
    @category << category[0]
  }
end

#get_category_listObject



27
28
29
30
# File 'lib/Charu/ChangeLogMemo.rb', line 27

def get_category_list()
  @category.uniq! # 重複削除
  return @category
end

#get_private_categoryObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/Charu/ChangeLogMemo.rb', line 32

def get_private_category()
  # プライベートの設定
  # パブリックのカテゴリーに指定したものだけ、公開することにしてあります。
  @category.each{|category|
    @config.public_category.each{|public_category|
      if category == public_category then
        @private_category = true
      end
    }
  }

  # プライベートの設定
  @category.each{|category|
    @config.private_category.each{|private_category|
      if category == private_category then
        @private_category = false
      end
    }
  }
  return @private_category
end