vic 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,28 +13,24 @@ module Vic
13
13
  update_arguments!(args)
14
14
  end
15
15
 
16
- # Returns and/or sets an argument for the current highlight.
17
- #
18
- # @param [String,Symbol] the argument key
19
- # @param [String,Array,nil] the values to assign to the argument key
20
- # @return [String,Symbol,Array,nil] the value of the argument key
21
- def method_missing(key, *args)
22
- super unless key =~ (/([a-z]+)=?/) and Argument.is_valid?($1)
23
- lookup = $1.to_s
24
- argument = argument_set.find_by_key(lookup)
25
- args = args.first if args.first.respond_to? :chr
26
-
27
- if not argument and args.empty?
28
- return
29
- elsif argument and not args.empty?
30
- argument.arg = args
31
- elsif argument and args.empty?
32
- return argument.arg
33
- elsif not args.empty?
34
- argument = Argument.new(lookup, args)
35
- arguments.add argument
16
+ # Sets the methods term, term=, start, start=, etc. for settings arguments.
17
+ self.class_eval do
18
+ %w{term start stop cterm ctermfg ctermbg gui guibg guifg}.each do |m|
19
+ define_method(m) {
20
+ argument = argument_set.find_by_key(m)
21
+ return argument.arg if argument
22
+ }
23
+ define_method("#{m}=") {|val|
24
+ argument = argument_set.find_by_key(m)
25
+ if argument
26
+ argument.arg = val
27
+ else
28
+ argument = Argument.new(m, val)
29
+ argument_set.add argument
30
+ end
31
+ val
32
+ }
36
33
  end
37
- argument.arg
38
34
  end
39
35
 
40
36
  # Updates/sets the current highlight's arguments.
data/lib/vic.rb CHANGED
@@ -1,9 +1,8 @@
1
- require 'set'
2
-
3
1
  module Vic
4
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
5
3
  end
6
4
 
5
+ require 'set'
7
6
  require 'vic/colorscheme'
8
7
  require 'vic/colorscheme/highlight'
9
8
  require 'vic/colorscheme/highlight_set'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-09 00:00:00.000000000Z
12
+ date: 2012-01-13 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Create Vim colorschemes with Ruby
15
15
  email: cjholdbrooks@gmail.com