1 # ohcount.rb written by Mitchell Foral. mitchell<att>caladbolg.net.
2 # See COPYING for license information.
3 # Ohcount module tweaked for use by Ohloh.
5 $: << File.expand_path(File.dirname(__FILE__))
10 def file_location=(value) set_diskpath(value) end
11 def file_location() diskpath() end
12 def filenames=(value) set_filenames(value) end
13 def contents() get_contents() end
14 def polyglot() get_language() end
16 def language_breakdowns
17 list = get_parsed_language_list()
18 return array_from_list(list, :pl)
21 def language_breakdown(language)
22 return language_breakdowns().find { |lb| lb.name == language.to_s }
26 list = get_license_list()
27 array = array_from_list(list, :lic)
28 return array.map! { |l| l.name }
32 return language_breakdowns().collect { |lb| lb.name }
37 return array_from_list(list, :loc)
42 ret = array_from_list(list, :delta)
44 def loc_deltas() self end
50 filenames.each { |f| yield f }
55 def array_from_list(list, method)
59 array << iter.send(method)
70 yield iter.sf if iter.sf.polyglot
75 # this should yield each filename, not an sf object
96 def self.binary_filename?(filename)
97 return Ohcount.ohcount_is_binary_filename(filename) == 1