Class: Remocon::Normalizer
- Inherits:
-
Object
- Object
- Remocon::Normalizer
show all
- Defined in:
- lib/remocon/normalizer/normalizer.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(content, opts) ⇒ Normalizer
Returns a new instance of Normalizer.
7
8
9
10
|
# File 'lib/remocon/normalizer/normalizer.rb', line 7
def initialize(content, opts)
@content = content.nil? ? opts[:default] : content
@opts = opts
end
|
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
5
6
7
|
# File 'lib/remocon/normalizer/normalizer.rb', line 5
def content
@content
end
|
Class Method Details
.respond_symbol ⇒ Object
29
30
31
|
# File 'lib/remocon/normalizer/normalizer.rb', line 29
def self.respond_symbol
raise Remocon::UnsupportedTypeError, "unknown"
end
|
Instance Method Details
#normalize ⇒ Object
25
26
27
|
# File 'lib/remocon/normalizer/normalizer.rb', line 25
def normalize
@content
end
|
#process ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/remocon/normalizer/normalizer.rb', line 12
def process
tap do
raise Remocon::ValidationError, "#{self.class} is not satisfying normalizer" unless self.class.respond_symbol
validate
@content = normalize
end
end
|
#validate ⇒ Object
21
22
23
|
# File 'lib/remocon/normalizer/normalizer.rb', line 21
def validate
end
|