albino 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/albino.gemspec +2 -2
  2. data/lib/albino.rb +8 -5
  3. metadata +4 -11
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'albino'
16
- s.version = '1.2.2'
17
- s.date = '2011-01-11'
16
+ s.version = '1.2.3'
17
+ s.date = '2011-01-12'
18
18
  s.rubyforge_project = 'albino'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -45,25 +45,28 @@ require 'albino/process'
45
45
  class Albino
46
46
  class ShellArgumentError < ArgumentError; end
47
47
 
48
- VERSION = '1.2.2'
48
+ VERSION = '1.2.3'
49
49
 
50
50
  class << self
51
- attr_accessor :bin
51
+ attr_accessor :bin, :default_encoding, :timeout_threshold
52
52
  end
53
+
54
+ self.timeout_threshold = 10
55
+ self.default_encoding = 'utf8'
53
56
  self.bin = 'pygmentize'
54
57
 
55
58
  def self.colorize(*args)
56
59
  new(*args).colorize
57
60
  end
58
61
 
59
- def initialize(target, lexer = :text, format = :html)
62
+ def initialize(target, lexer = :text, format = :html, encoding = self.class.default_encoding)
60
63
  @target = target
61
- @options = { :l => lexer, :f => format }
64
+ @options = { :l => lexer, :f => format, :O => "encoding=#{encoding}" }
62
65
  end
63
66
 
64
67
  def execute(options = {})
65
68
  proc_options = {}
66
- proc_options[:timeout] = options.delete(:timeout) || 5
69
+ proc_options[:timeout] = options.delete(:timeout) || self.class.timeout_threshold
67
70
  command = convert_options(options)
68
71
  command.unshift(bin)
69
72
  Process.new(command, env={}, proc_options.merge(:input => write_target))
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: albino
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 2
9
- - 2
10
- version: 1.2.2
8
+ - 3
9
+ version: 1.2.3
11
10
  platform: ruby
12
11
  authors:
13
12
  - Chris Wanstrath
@@ -15,18 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-01-11 00:00:00 -08:00
17
+ date: 2011-01-12 00:00:00 -08:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: mocha
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
25
  - - ">="
28
26
  - !ruby/object:Gem::Version
29
- hash: 3
30
27
  segments:
31
28
  - 0
32
29
  version: "0"
@@ -59,27 +56,23 @@ rdoc_options: []
59
56
  require_paths:
60
57
  - lib
61
58
  required_ruby_version: !ruby/object:Gem::Requirement
62
- none: false
63
59
  requirements:
64
60
  - - ">="
65
61
  - !ruby/object:Gem::Version
66
- hash: 3
67
62
  segments:
68
63
  - 0
69
64
  version: "0"
70
65
  required_rubygems_version: !ruby/object:Gem::Requirement
71
- none: false
72
66
  requirements:
73
67
  - - ">="
74
68
  - !ruby/object:Gem::Version
75
- hash: 3
76
69
  segments:
77
70
  - 0
78
71
  version: "0"
79
72
  requirements: []
80
73
 
81
74
  rubyforge_project: albino
82
- rubygems_version: 1.3.7
75
+ rubygems_version: 1.3.6
83
76
  signing_key:
84
77
  specification_version: 2
85
78
  summary: Ruby wrapper for pygmentize.