Class: UserChoices::AbstractSource
- Inherits:
-
Hash
- Object
- Hash
- UserChoices::AbstractSource
show all
- Defined in:
- lib/user-choices/sources.rb
Overview
TODO: Right now, elements that are named in a source, but not in an add_choice() call, nevertheless appear in the final array. Is that good? Bad? Irrelevant?
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of AbstractSource.
20
21
22
23
|
# File 'lib/user-choices/sources.rb', line 20
def initialize
super()
@external_names = {}
end
|
Instance Attribute Details
#external_names ⇒ Object
18
19
20
|
# File 'lib/user-choices/sources.rb', line 18
def external_names
@external_names
end
|
Instance Method Details
#adjust(final_results) ⇒ Object
42
43
44
|
# File 'lib/user-choices/sources.rb', line 42
def adjust(final_results)
end
|
#apply(choice_conversions) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/user-choices/sources.rb', line 30
def apply(choice_conversions)
each_conversion(choice_conversions) do | choice, conversion |
next unless self.has_key?(choice)
user_claims(conversion.suitable?(self[choice])) {
error_prefix + bad_look(choice, conversion)
}
self[choice] = conversion.convert(self[choice])
end
end
|
#each_conversion(choice_conversion_hash) ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/user-choices/sources.rb', line 46
def each_conversion(choice_conversion_hash)
choice_conversion_hash.each do | choice, conversion_list |
conversion_list.each do | conversion |
yield(choice, conversion)
end
end
end
|
#fill ⇒ Object
28
|
# File 'lib/user-choices/sources.rb', line 28
def fill; subclass_responsibility; end
|
#source ⇒ Object
25
|
# File 'lib/user-choices/sources.rb', line 25
def source; subclass_responsibility; end
|