module JYRon::Inputs

Constants

CLI_INPUTS
INPUTS_LIST

Public Instance Methods

from_json(string) click to toggle source
# File lib/jyron/inputs.rb, line 24
def from_json(string)
  begin
    @object = JSON.parse(string)
    adapt
    return self
  rescue JSON::ParserError
    raise BadInputFormat.new 'Not in JSON format'
  end
end
from_rb(string) click to toggle source
# File lib/jyron/inputs.rb, line 34
def from_rb(string)
  eval("@object=#{string}")
  adapt
  return self
end
from_yaml(string) click to toggle source
# File lib/jyron/inputs.rb, line 14
def from_yaml(string)
  begin
    @object = YAML::load(string)
    adapt
    return self
  rescue Psych::SyntaxError
    raise BadInputFormat.new 'Not in YAML format'
  end
end