Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dsandstrom/atom-ruby-block-converter
Convert Ruby Block Styles
https://github.com/dsandstrom/atom-ruby-block-converter
Last synced: about 1 month ago
JSON representation
Convert Ruby Block Styles
- Host: GitHub
- URL: https://github.com/dsandstrom/atom-ruby-block-converter
- Owner: dsandstrom
- License: mit
- Created: 2014-07-20T06:56:17.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-06-28T01:40:58.000Z (over 6 years ago)
- Last Synced: 2023-05-02T12:58:27.817Z (over 1 year ago)
- Language: CoffeeScript
- Homepage:
- Size: 213 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Ruby Block Converter
###### An Atom Package - [Atom.io](https://atom.io/packages/ruby-block-converter) : [Github](https://github.com/dsandstrom/atom-ruby-block-converter)
[![Build Status](https://travis-ci.org/dsandstrom/atom-ruby-block-converter.svg?branch=master)](https://travis-ci.org/dsandstrom/atom-ruby-block-converter)Convert Ruby blocks between single line and multi line formats. Or between curly brackets and do-end statements.
![Screenshot](https://github.com/dsandstrom/atom-ruby-block-converter/raw/master/screen-1.gif) ![Screenshot](https://github.com/dsandstrom/atom-ruby-block-converter/raw/master/screen-2.gif)
### Instructions
###### *{ } => do-end*Place the cursor in between the brackets and hit the shortcut.
| | macOS | Linux/Win |
|:----------------|:-------------|:----------|
| Normal | `ctrl-}` | `alt-]` |
| Without joining | `ctrl-alt-}` | `alt-}` |###### *do-end => { }*
Place the cursor in between the do-end and hit the shortcut.
| | macOS | Linux/Win |
|:-----------------|:-------------|:----------|
| Normal | `ctrl-{` | `alt-[` |
| Without collapse | `ctrl-alt-{` | `alt-{` |### Features
* Hashes and string interpolation are ignored
* RSpec blocks are honored.
* There are separate commands if you don't want the block to collapse or join### How It Works
* It looks for the first starting block on the current line, then up. Upon success, it looks right, then down for a matching } or end.
* When there is a block with only one line of code: the curly converter will join the block onto one line; the do-end converter will separate the three lines and then auto-tab.
* It will only try up or down 6 lines, but this configurable in your settings.### Commands
```coffee
'ruby-block-converter:to-curly-brackets'
'ruby-block-converter:to-curly-brackets-without-collapse'
'ruby-block-converter:to-do-end'
'ruby-block-converter:to-do-end-without-join'
```### Notes
* Version 4.0.0 introduces changes to the macOS keymaps### Thanks
Inspired by the Sublime Text [Ruby Block Converter](https://github.com/irohiroki/RubyBlockConverter) by [irohiroki](https://github.com/irohiroki).