Displaying 20 results from an estimated 113 matches for "unshift".
2008 Feb 12
1
$:.unshift File.join(File.dirname(__FILE__),'..','lib')?
What this code lines mean? Especially $:. before the unshift?
$:.unshift File.join(File.dirname(__FILE__),''..'',''lib'')
Regards,
Mohsin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this grou...
2006 Mar 03
1
starting webrick from ruby (tar2rubyscript.rb)
I am using tar2rubyscript to package up a rails application and run it
as one file from the server.
If you run script/server and have lighttpd install it will start lighty
instead of webrick. So, thanks to Erik Veenstra''s suggestion, I add
ARGV.unshift("webrick") to the init.rb file to force webrick to start:
ARGV.unshift("webrick")
load "script/server"
How would I then specify the port for webrick to listen to?
I tried adding another ARGV.unshift("--port=1234") but it didnt work.
Cheers Kris.
PS. I r...
2016 Jul 07
12
[PATCH v3 0/8] v2v: Move Curl wrapper to mllib and more.
v2 -> v3:
- Changes to the Curl API suggested by Pino.
2016 Jul 07
9
[PATCH v2 0/8] v2v: Move Curl wrapper to mllib and use it for virt-builder (and more).
v1 -> v2:
- Fixed the bug with precedence of if / @.
- Add some imperative list operators inspired by Perl, and use those
for constructing the Curl arguments, and more.
Rich.
2009 Jun 22
0
Array unshift and save to database
Hello,
I''ve noticed that I can''t save my object to the DB after using ''unshift''
on one of Array fileds. Ex:
(below ''tags'' is a collection in object ''transaction'')
transaction.tags.unshift(Tag.find_or_create_by_name(name))
transaction.save!
Everything is fine when I am using ''<<'' to append tag to array.
R...
2008 Jan 29
4
Setting up release-1.0.1
...ript/backgroundrb (revision 313)
+++ script/backgroundrb (working copy)
@@ -6,8 +6,10 @@
WORKER_ROOT = rails_root + "/lib/workers"
SERVER_LOGGER = rails_root + "/log/backgroundrb_server.log"
-["server","framework","lib"].each { |x|
$LOAD_PATH.unshift(PACKET_APP + "/#{x}")}
-$LOAD_PATH.unshift(WORKER_ROOT)
+#["server","framework","lib"].each { |x|
$LOAD_PATH.unshift(PACKET_APP + "/#{x}")}
+["server","framework","lib"].each { |x| $:.push(PACKET_APP +
"/#{x}&qu...
2014 Jan 13
3
[PATCH 1/3] ruby: Fix tests for out-of-tree build, simplify test scripts
...EST="$f"
+done
diff --git a/ruby/tests/tc_010_load.rb b/ruby/tests/tc_010_load.rb
index 113ab69..8a8ae51 100644
--- a/ruby/tests/tc_010_load.rb
+++ b/ruby/tests/tc_010_load.rb
@@ -16,8 +16,6 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
require 'test/unit'
-$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
-$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "hivex"))
require 'hivex'
class TestLoad < Test::Unit::TestCase
diff --git a/ruby/tests/tc_021_close.rb b/ruby/tests/tc_021...
2013 Dec 27
0
[PATCH] ruby: Fix .new method (RHBZ#1046509).
...+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+require 'test/unit'
+$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
+$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
+require 'guestfs'
+
+class TestLoad < Test::Unit::TestCase
+ def test_create_flags
+ g = Guestfs::Guestfs.new(...
2007 Apr 30
1
collection_select - prepending a "any" option
Say I have a normal <SELECT> tag being generated thusly:
<%= collection_select :task, :id, Task.find(:all), :id, :name %>
what is the easiest way to add a "ANY" option to the top of the option
list? I know Task.find(:all) returns a collection object, so is there
a unshift() for that?
well OK I tried:
Task.find(:all).unshift([:id=>0, :name=>''ANY''])
but that is just a vanilla Array with "undefined method `name''"....?
thanks
Sam
--~--~---------~--~----~------------~-------~--~----~
You received this message because...
2016 Jul 08
2
Re: [PATCH v3 4/8] mllib: Add some imperative list manipulation functions.
...t xs = ys in
> > > let xs = if foo then xs @ zs else xs in
> > >
> > > with:
> > >
> > > let xs = ref ys in
> > > if foo then append xs zs;
> > > ---
> >
> > TBH I've always found the "shift" and "unshift" naming of Perl
> > functions slightly awkward, but can live with them. (At least the
> > new functions do the same as Perl ones.)
>
> I agree, but for consistency I thought it was better to keep those
> names rather than trying to think up new ones which would be differe...
2007 Nov 24
5
Service.start arguments failing or causing segfault
...vice.start should be
passed to the Daemon''s service_main method. Correct?
I modified the Service.start method (now in CVS) to look something like
this:
def self.start(service, host=nil, *args)
...
num_args = args.length
if args.empty?
args = nil
else
args.unshift(service) # Necessary?
args = [args.join("\000")].pack(''p*'') # Must pack?
end
unless StartService(handle_scs, num_args, args)
...
end
I wasn''t sure if I needed to explicitly push the service name onto the
array, but it does segfault without...
2014 Jan 10
4
[PATCH] Add a minimal hive with "special" keys and values
---
images/README | 15 +++++++++++++++
images/mkzero/Makefile | 7 +++++++
images/mkzero/mkzero.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
images/special | Bin 0 -> 8192 bytes
4 files changed, 70 insertions(+)
create mode 100644 images/mkzero/Makefile
create mode 100644 images/mkzero/mkzero.c
create mode 100644 images/special
diff --git a/images/README
2016 Jul 07
0
[PATCH v3 4/8] mllib: Add some imperative list manipulation functions.
...tions(+)
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 77b9acd..40a19bc 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -282,6 +282,26 @@ let sort_uniq ?(cmp = Pervasives.compare) xs =
let xs = uniq ~cmp xs in
xs
+let push xsp x = xsp := !xsp @ [x]
+let unshift x xsp = xsp := x :: !xsp
+let pop xsp =
+ let x, xs =
+ match List.rev !xsp with
+ | x :: xs -> x, xs
+ | [] -> failwith "pop" in
+ xsp := List.rev xs;
+ x
+let shift xsp =
+ let x, xs =
+ match !xsp with
+ | x :: xs -> x, xs
+ | [] -> failwith "shif...
2010 Apr 20
2
shift and pop equivalent in R
Dear All,
I am wondering is there any shift (or pop or push or unshift) equivalent in R?
For example,
shift(x) # should return x[1], and x becomes x[-1]
Thanks a lot.
Best Regards,
Xie Chao
2006 May 05
3
Plugin refresh time
Hi there,
I''m currently developing a plugin to do authentication and
authorisation. In the init.rb file of the plugin I have this code:-
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), ''lib''))
require ''open_advantage/authorisation''
ActionController::Base.send :include, OpenAdvantage::Authorisation
and this is the skeleton of my plugin directory structure:-
vendor/plugins/open_advantage/init...
2016 Jul 07
2
Re: [PATCH v3 4/8] mllib: Add some imperative list manipulation functions.
...t;
> This allows us to replace some awkward pure functional code like:
>
> let xs = ys in
> let xs = if foo then xs @ zs else xs in
>
> with:
>
> let xs = ref ys in
> if foo then append xs zs;
> ---
TBH I've always found the "shift" and "unshift" naming of Perl
functions slightly awkward, but can live with them. (At least the
new functions do the same as Perl ones.)
--
Pino Toscano
2005 Feb 08
2
test_process.rb => LoadError
...tests in Rails running under
1.8.2
class Object #:nodoc:
alias_method :require_without_load_path_reloading, :require
def require(file_name)
begin
require_without_load_path_reloading(file_name)
rescue Object => e
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if
File.directory?(dir) }
require_without_load_path_reloading(file_name)
end
end
end
end
Can we change the rescue line to:
rescue LoadError => e
I''m not sure what this "temporary hack for getting functional tests in
Rails running under 1.8.2"...
2006 Jan 23
3
date.to_s trimming
...it like so:
@date =
@meeting.date.to_s.chomp.chomp.chomp.chomp.chomp.chomp.chomp.chomp.chomp.chomp.chomp.chomp
but the chomps seem to do nothing. I''d love to use regex, but I don''t
know which method to use to remove text from a string, or to just sever
the end of it (I tried unshift).
--
Posted via http://www.ruby-forum.com/.
2009 Mar 08
2
rspec 1.1.99.12, Rails 2.3.1, undefined method `rspec_options=''
...-rails
according to: http://wiki.github.com/dchelimsky/rspec/rails-with-rspec-gems.
and when I run ''rake gem'' fails with error:
rake aborted!
undefined method `rspec_options='' for #<Hoe:0xb782caf0>
/rspec/Rakefile:24
rspec / Rakefile look like
# -*- ruby -*-
$:.unshift(File.join(File.dirname(__FILE__), ''lib''))
require ''hoe''
require ''spec/version''
require ''spec/rake/spectask''
require ''cucumber/rake/task''
class Hoe
def extra_deps
@extra_deps.reject! { |x| Array(x).first...
2007 Sep 18
2
FW: Specifying spec and output format inline?
...equire ''spec'' and forego running scripts from
the command line. However, this limits me in my output formats. Is
there a way that I can specify which format to use and where to save it
inside the script?
I''ve included the full script below.
Thanks,
Adam
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), ''..'') if $0 ==
__FILE__ #set the local dir path
require ''watir''
require ''spec''
describe "Project name" do
before(:all) do
@browser = Watir::IE.new
@browser.goto "http://localhost:8...