Class: Contracto::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/contracto/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(strings_with_json) ⇒ Parser

Returns a new instance of Parser.



4
5
6
# File 'lib/contracto/parser.rb', line 4

def initialize(strings_with_json)
  @json_collection = strings_with_json.map { |string| JSON.parse(string) }
end

Instance Method Details

#contractsObject



8
9
10
11
12
13
14
# File 'lib/contracto/parser.rb', line 8

def contracts
  @json_collection.map do |json|
    Array(json).map do |json|
      Contracto::Contract.new(json)
    end
  end.flatten
end