Module: Officepod::Helper
- Included in:
- Base
- Defined in:
- lib/officepod/helper.rb
Instance Method Summary collapse
- #body_empty? ⇒ Boolean
- #command_empty? ⇒ Boolean
- #unsupported_command? ⇒ Boolean
- #validates_body ⇒ Object
- #validates_command ⇒ Object
Instance Method Details
#body_empty? ⇒ Boolean
26 27 28 |
# File 'lib/officepod/helper.rb', line 26 def body_empty? [:body].empty? end |
#command_empty? ⇒ Boolean
22 23 24 |
# File 'lib/officepod/helper.rb', line 22 def command_empty? @command.empty? end |
#unsupported_command? ⇒ Boolean
18 19 20 |
# File 'lib/officepod/helper.rb', line 18 def unsupported_command? !(self.class.instance_methods.include?(@command.to_sym)) end |
#validates_body ⇒ Object
14 15 16 |
# File 'lib/officepod/helper.rb', line 14 def validates_body raise Officepod::Exception::EmptyBody.new if body_empty? end |
#validates_command ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/officepod/helper.rb', line 4 def validates_command if command_empty? raise Officepod::Exception::EmptyCommand.new else if unsupported_command? raise Officepod::Exception::UnsupportedCommand.new(@command) end end end |