Class: Exerb::Recipe::GeneralBlock
- Inherits:
-
Object
- Object
- Exerb::Recipe::GeneralBlock
- Defined in:
- lib/exerb/recipe.rb
Overview
#
Constant Summary collapse
- KCODE =
['none', 'euc', 'sjis', 'utf8']
Instance Attribute Summary collapse
-
#core ⇒ Object
readonly
Returns the value of attribute core.
-
#kcode ⇒ Object
readonly
Returns the value of attribute kcode.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#startup ⇒ Object
readonly
Returns the value of attribute startup.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(block, filename) ⇒ GeneralBlock
constructor
A new instance of GeneralBlock.
Constructor Details
#initialize(block, filename) ⇒ GeneralBlock
Returns a new instance of GeneralBlock.
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/exerb/recipe.rb', line 170 def initialize(block, filename) @startup = block.delete('startup') || "" @output = block.delete('output') || "" @core = block.delete('core') || "" @kcode = block.delete('kcode') || "none" @startup = nil if @startup.empty? @output = nil if @output.empty? @core = nil if @core.empty? @kcode.downcase! raise(Exerb::ExerbError, "#{filename}: unknown field at general block -- #{block.keys.join(', ')}") unless block.empty? raise(Exerb::ExerbError, "#{filename}: startup field isn't specified at general block") if @startup.nil? raise(Exerb::ExerbError, "#{filename}: unknown kcode at general block -- #{@kcode}") unless KCODE.include?(@kcode) end |
Instance Attribute Details
#core ⇒ Object (readonly)
Returns the value of attribute core.
186 187 188 |
# File 'lib/exerb/recipe.rb', line 186 def core @core end |
#kcode ⇒ Object (readonly)
Returns the value of attribute kcode.
186 187 188 |
# File 'lib/exerb/recipe.rb', line 186 def kcode @kcode end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
186 187 188 |
# File 'lib/exerb/recipe.rb', line 186 def output @output end |
#startup ⇒ Object (readonly)
Returns the value of attribute startup.
186 187 188 |
# File 'lib/exerb/recipe.rb', line 186 def startup @startup end |
Class Method Details
.analyze(blocks, filename) ⇒ Object
188 189 190 191 192 193 |
# File 'lib/exerb/recipe.rb', line 188 def self.analyze(blocks, filename) block = blocks.delete("general") raise(Exerb::ExerbError, "#{filename}: general block not found") if block.nil? raise(Exerb::ExerbError, "#{filename}: general block must be Hash object -- #{block.class}") unless block.kind_of?(Hash) return self.new(block, filename) end |