class ReVIEW::Catalog
Public Class Methods
new(file)
click to toggle source
# File lib/review/catalog.rb, line 5 def initialize(file) if file.respond_to? :read @yaml = YAML.load(file.read) else ## as Object @yaml = file end @yaml ||= {} end
Public Instance Methods
appendix()
click to toggle source
# File lib/review/catalog.rb, line 46 def appendix return "" unless @yaml["APPENDIX"] @yaml["APPENDIX"].join("\n") end
chaps()
click to toggle source
# File lib/review/catalog.rb, line 19 def chaps return "" unless @yaml["CHAPS"] @yaml["CHAPS"].map {|entry| if entry.is_a? String entry elsif entry.is_a? Hash entry.values # chaps in a part end }.flatten.join("\n") end
parts()
click to toggle source
# File lib/review/catalog.rb, line 31 def parts return "" unless @yaml["CHAPS"] @yaml["CHAPS"].map {|entry| if entry.is_a? Hash entry.keys end }.flatten.compact.join("\n") end
parts_with_chaps()
click to toggle source
# File lib/review/catalog.rb, line 41 def parts_with_chaps return "" unless @yaml["CHAPS"] @yaml["CHAPS"].flatten.compact end
postdef()
click to toggle source
# File lib/review/catalog.rb, line 51 def postdef return "" unless @yaml["POSTDEF"] @yaml["POSTDEF"].join("\n") end
predef()
click to toggle source
# File lib/review/catalog.rb, line 14 def predef return "" unless @yaml["PREDEF"] @yaml["PREDEF"].join("\n") end