Module: Officepod::Helper

Defined in:
lib/officepod/helper.rb

Instance Method Summary collapse

Instance Method Details

#body_empty?Boolean

Returns:

  • (Boolean)


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

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

#class_methodsObject



29
30
31
# File 'lib/officepod/helper.rb', line 29

def class_methods
  self.methods - Object.methods
end

#command_empty?Boolean

Returns:

  • (Boolean)


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

def command_empty?
  @options[:command].empty?
end

#unsupported_command?Boolean

Returns:

  • (Boolean)


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

def unsupported_command?
  !(self.class_methods.include? @options[:command].to_sym)
end

#validates_bodyObject



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

def validates_body
  ::Kernel.raise EmptyBody.new if body_empty?
end

#validates_commandObject



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