-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to pass arguments to a javascript file #60
Comments
Looks like the PhantomJs#run takes in multiple arguments. https://github.com/colszowka/phantomjs-gem/blob/master/lib/phantomjs.rb#L49 Something like this should work: Phantomjs.run('highcharts-convert.js', '-infile option.json', '-outfile chart.png', '-scale 4', '-width 1000', '-constr Chart') |
I'm sending params to Run as an array of options = {
infile: 'option.json',
outfile: 'chart.png',
scale: 4,
width: 1000,
constr: 'Chart'
}.collect { |k, v| "#{k}=#{v}" }
Phantomjs.run('highcharts-conver.js', options) |
how do you use the options in the Javscript file?
|
I personally did it like that:
In
|
@nflorentin This looks more reasonable for my script: opts = [file, opt1, opt2]
Phantomjs.run(*opts) Thanks |
I could run a javascript file named 'highcharts-convert.js' which can generate images of charts on server side.
With original phantomjs command, I just run the command lke below:
%phantomjs highcharts-convert.js -infile option.json -outfile chart.png -scale 4 -width 1000 -constr Chart
I just want to do same thing with phantomjs-gem in ruby program, but I can not find a way to pass arguments, e.g., "-infile option.json -outfile chart.png -scale 4 -width 1000 -constr Chart".
Is it possible to pass arguments to the javascript file with phantomjs-gem?
The text was updated successfully, but these errors were encountered: