added sample.rb
updated rspec
added encode method
modified .rubocop.yml