mirror of
https://github.com/amix/vimrc
synced 2025-07-07 17:05:00 +08:00
Add support of auto format files.
This commit is contained in:
33
sources_non_forked/vim-autoformat/samples/ruby.rb
Normal file
33
sources_non_forked/vim-autoformat/samples/ruby.rb
Normal file
@ -0,0 +1,33 @@
|
||||
require 'inifile'
|
||||
|
||||
# Reads settings from init file
|
||||
class Settings
|
||||
attr_reader :jusername, :jpassword, :jurl
|
||||
|
||||
def initialize(path)
|
||||
settings = read(path)
|
||||
parse(settings)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def read(path)
|
||||
settings = IniFile.load(path)
|
||||
fail "File #{path} not found!" unless settings
|
||||
settings
|
||||
end
|
||||
|
||||
def parse(settings)
|
||||
jira = settings['jira']
|
||||
fail "Init file hasn't [jira] section!" unless jira
|
||||
|
||||
@jusername = jira['username']
|
||||
@jpassword = jira['password']
|
||||
@jurl = jira['url']
|
||||
|
||||
fail "Init file hasn't username option!" unless jusername
|
||||
fail "Init file hasn't password option!" unless jpassword
|
||||
fail "Init file hasn't url option!" unless jurl
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user