Sha256: d8a949895684a8aa09ae97d43a7c1f35782ccfac9371d06695289f2233fe1f34

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

# Defines some shortcuts for ad-hoc work with Rika.
#
# Can be used with the `irb`/`jirb` or `pry` (https://github.com/pry/pry) interactive shells:
# `pry -r rika_helper.rb`
#
# Can be used with the `rexe` command line executor (https://github.com/keithrbennett/rexe):
# rexe -r ./rika_helper.rb # e.g., add: `-oa 'm "x.pdf"'` to output metadata w/AwesomePrint
#
# or plain Ruby:
# ruby -r ./rika_helper -r awesome_print -e 'ap m("x.pdf")'

require 'rika'

def c(resource)
  Rika.parse_content(resource)
end

def m(resource)
  Rika.parse_metadata(resource)
end

def cm(resource)
  Rika.parse_content_and_metadata(resource)
end

def cmh(resource)
  Rika.parse_content_and_metadata_as_hash(resource)
end

def mj(resource); m(resource).to_json                      ; end
def mJ(resource); JSON.pretty_generate(m(resource))        ; end
def my(resource); m(resource).to_yaml                      ; end
def my(resource); require 'awesome_print'; m(resource).ai  ;end

def cmj(resource); c(resource).to_json;               end
def cmJ(resource); JSON.pretty_generate(c(resource)); end
def cmy(resource); c(resource).to_yaml              ; end
def cma(resource); require 'awesome_print'; c,m = cm(resource); { content: c, metadata: m }; end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rika-1.11.1-java rika_helper.rb