Module: Officepod::Helper

Included in:
Base
Defined in:
lib/officepod/helper.rb

Instance Method Summary collapse

Instance Method Details

#body_empty?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/officepod/helper.rb', line 26

def body_empty?
  @options[:body].empty?
end

#command_empty?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/officepod/helper.rb', line 22

def command_empty?
  @command.empty?
end

#unsupported_command?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/officepod/helper.rb', line 18

def unsupported_command?
  !(self.class.instance_methods.include?(@command.to_sym))
end

#validates_bodyObject



14
15
16
# File 'lib/officepod/helper.rb', line 14

def validates_body
  raise Officepod::Exception::EmptyBody.new if body_empty?
end

#validates_commandObject



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