Class: Traceur::CompilationOptions
- Inherits:
-
Object
- Object
- Traceur::CompilationOptions
show all
- Defined in:
- lib/traceur/compilation_options.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of CompilationOptions.
5
6
7
8
|
# File 'lib/traceur/compilation_options.rb', line 5
def initialize(options = {})
@options = {}
merge!(options)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
47
48
49
50
51
|
# File 'lib/traceur/compilation_options.rb', line 47
def method_missing(name, *args, &block)
return self[name] = args.first if setter?(name, args)
return self[name] if getter?(name, args)
super
end
|
Instance Method Details
#[](name) ⇒ Object
14
15
16
|
# File 'lib/traceur/compilation_options.rb', line 14
def [](name)
@options[normalize(name)]
end
|
#[]=(name, value) ⇒ Object
10
11
12
|
# File 'lib/traceur/compilation_options.rb', line 10
def []=(name, value)
@options[normalize(name)] = value
end
|
#each(&block) ⇒ Object
29
30
31
|
# File 'lib/traceur/compilation_options.rb', line 29
def each(&block)
@options.each(&block)
end
|
#merge(options) ⇒ Object
25
26
27
|
# File 'lib/traceur/compilation_options.rb', line 25
def merge(options)
CompilationOptions.new(self).merge!(options)
end
|
#merge!(options) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/traceur/compilation_options.rb', line 18
def merge!(options)
options.each do |key, value|
self[key] = value
end
self
end
|
#to_hash ⇒ Object
33
34
35
|
# File 'lib/traceur/compilation_options.rb', line 33
def to_hash
@options
end
|
#to_json ⇒ Object
37
38
39
|
# File 'lib/traceur/compilation_options.rb', line 37
def to_json
to_hash.to_json
end
|