Module: Officepod::Helper
- Defined in:
- lib/officepod/helper.rb
Instance Method Summary collapse
- #body_empty? ⇒ Boolean
- #class_methods ⇒ Object
- #command_empty? ⇒ Boolean
- #unsupported_command? ⇒ Boolean
- #validates_body ⇒ Object
- #validates_command ⇒ Object
Instance Method Details
#body_empty? ⇒ Boolean
25 26 27 |
# File 'lib/officepod/helper.rb', line 25 def body_empty? @options[:body].empty? end |
#class_methods ⇒ Object
29 30 31 |
# File 'lib/officepod/helper.rb', line 29 def class_methods self.methods - Object.methods end |
#command_empty? ⇒ Boolean
21 22 23 |
# File 'lib/officepod/helper.rb', line 21 def command_empty? @options[:command].empty? end |
#unsupported_command? ⇒ Boolean
17 18 19 |
# File 'lib/officepod/helper.rb', line 17 def unsupported_command? !(self.class_methods.include? @options[:command].to_sym) end |
#validates_body ⇒ Object
13 14 15 |
# File 'lib/officepod/helper.rb', line 13 def validates_body ::Kernel.raise EmptyBody.new if body_empty? end |
#validates_command ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/officepod/helper.rb', line 3 def validates_command if command_empty? ::Kernel.raise EmptyCommand.new else if unsupported_command? ::Kernel.raise UnsupportedCommand.new(@options[:command]) end end end |