shelr 0.15.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/shelr/player.rb CHANGED
@@ -58,30 +58,27 @@ module Shelr
58
58
 
59
59
  def play
60
60
  Shelr.terminal.puts_line
61
- system(scriptreplay_cmd)
61
+ self.class.scriptreplay record_file('typescript'), record_file('timing')
62
62
  Shelr.terminal.puts_line
63
63
  end
64
64
 
65
- private
66
-
67
- def scriptreplay(typescript_file, timing_file)
65
+ def self.scriptreplay(typescript_file, timing_file)
68
66
  typescript = File.open(typescript_file)
69
67
  timing = File.open(timing_file)
70
68
  frames = timing.read.split("\n").map { |line| line.split(" ") }
69
+ frames.map! { |k,v| [k.to_f.abs, v.to_i] }
71
70
  typescript.gets # skip first line
72
71
 
73
72
  frames.each do |usec,length|
74
- sleep(usec.to_f)
75
- print typescript.read(length.to_i)
73
+ sleep(usec)
74
+ print typescript.read(length)
76
75
  end
77
76
  end
78
77
 
78
+ private
79
+
79
80
  def record_file(name)
80
81
  File.join(Shelr.data_dir(@record_id), name)
81
82
  end
82
-
83
- def scriptreplay_cmd
84
- scriptreplay record_file('typescript'), record_file('timing')
85
- end
86
83
  end
87
84
  end
data/lib/shelr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Shelr
2
- VERSION = '0.15.0'
2
+ VERSION = '0.15.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shelr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -87,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  segments:
89
89
  - 0
90
- hash: 2426833572865576322
90
+ hash: -2890209421750652881
91
91
  required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  none: false
93
93
  requirements:
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  segments:
98
98
  - 0
99
- hash: 2426833572865576322
99
+ hash: -2890209421750652881
100
100
  requirements: []
101
101
  rubyforge_project:
102
102
  rubygems_version: 1.8.21