Hot answers tagged

5

Short answer Because making use of a live process has been easier to implement than writing a static indexer. And because Ruby's metaprogramming abilities make almost any external indexer necessarily imprecise. With Ruby's introspection capabilities, a dynamic indexer can access very accurate information about of the set of defined methods and their source ...


3

Assuming rspec: Install rspec-mode, which will activate itself automatically in ruby-mode or enh-ruby-mode then you can use C-c,s to run rspec-verify-single which will run the test at point.


3

The two main options are: Pass the value as an argument, or via standard input. Take a look at how erm-ruby-get-process passes through the value of enh-ruby-extra-keywords. Use an environment variable or several, and set them where you're calling the Ruby process. Maybe let-bind process-environment to itself around that code so it's unchanged in the end (...


2

For others who may want to know the answer, I finally figured it out. In the case of ruby, you should insert a nil where you want the hline to appear. Org represents a table as an array of arrays. Here is what I used to discover the right incantation for ruby: #+NAME: test | Ref | Value | |------+-------| | 0001 | blue | | 0002 | red | #+HEADER: :...


1

I'll let someone else clear that issue up for Flycheck. But for completeness' sake: if you install a recent snapshot of Emacs 27 (to be released soon-ish) and enable flymake-mode in Ruby buffers, Rubocop integration is there, and it appends "bundle exec" when appropriate.


1

we want to add a line containing the word "byebug" to the preceding line of any line containing create( Here's a replace-regexp approach: M-x query-replace-regexp RET ^.*create( RET byebug C-qC-j \& RET


1

On OS X, running Emacs GUI does not get the environment variables, I would guess that your RVM is of no use in such environment without the $PATH set properly. Steve Purcell made a Elisp library that enables Emacs GUI to get the environment variables: exec-path-from-shell To install it (from melpa): M-x package-list-packages Search for exec-path-from-...


1

There are two options you could use, but I imagine that none are exactly what you want: 1) Create derived classes from the template classes #+begin_src ruby :tangle ./app/models/appuser.rb class AppUser < User after_create :create_braintree_customer def create_braintree_customer Braintree.api_key = "bk-54cfa45" self.id = Braintree::...


1

That depends on what kind of project you're working on. If it's a gem, it most likely require-s all modules in the top-level file (the one under lib). M-x inf-ruby-console-gem will load it and in turn, all modules. If it's a Rails project, M-x inf-ruby-console-rails will load Rails console. Most modules use autoloads, but C-x C-k should load them all using ...


1

I'm not a ruby user but you can try the following: (setq-default indent-tabs-mode nil) (setq-default tab-width 4) ;; change this to 2 if that is the width (setq indent-line-function 'insert-tab)


1

This way it works: (defun get-current-test-name () (save-excursion (let ((pos) (test-name)) (re-search-backward "test \"\\([^\"]+\\)\" do") (setq test-name (buffer-substring-no-properties (match-beginning 1) (match-end 1))) (concat "test_" (replace-regexp-in-string " " "_" test-name))))) (defun run-test-at-point () (...


1

I use next function to run rails console on remote host. It seems that run-ruby doesn't care how REPL is started, so I pass it an ssh command. Most important part is the command itself: -t for pseudo-terminal mode, without it repl won't work; bash --login to get usual shell (for rbenv, rvm or other stuff that initialised on shell startup). If you use zsh, ...


1

I had to change eshell-interpreter-alist to Regexp: \.rb Interpreter: eshell-run-ruby-command-from-path And provide the following function to make it work (defun eshell-run-ruby-command-from-path (args) (eshell-named-command "ruby.exe" (list (eshell-search-path args))))


1

Apparently, the thing to do is to edit the project over TRAMP (not in a shared directory). Running specs over TRAMP has just been fixed in rspec-mode.


Only top voted, non community-wiki answers of a minimum length are eligible