class Contracto::Parser

Public Class Methods

new(strings_with_json) click to toggle source
# File lib/contracto/parser.rb, line 6
def initialize(strings_with_json)
  @json_collection = strings_with_json.map { |string| JSON.parse(string) }
end

Public Instance Methods

contracts() click to toggle source
# File lib/contracto/parser.rb, line 10
def contracts
  @json_collection.map do |json|
    json = [json] unless json.is_a?(Array)
    json.map do |json|
      Contracto::Contract.new(json)
    end
  end.flatten.tap do |contracts|
    Contracto::Stats.all_contracts = contracts
  end
end