barrister 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/barrister.rb +15 -1
  2. metadata +4 -4
data/lib/barrister.rb CHANGED
@@ -290,6 +290,13 @@ module Barrister
290
290
  load_contract
291
291
  init_proxies
292
292
  end
293
+
294
+ # Returns the hash of metadata from the Contract, which includes the date the
295
+ # IDL was translated to JSON, the Barrister version used to translate the IDL, and
296
+ # a checksum of the IDL which can be used to detect version changes.
297
+ def get_meta
298
+ return @contract.meta
299
+ end
293
300
 
294
301
  # Returns a Barrister::BatchClient instance that is associated with this Client instance
295
302
  #
@@ -563,7 +570,7 @@ module Barrister
563
570
  class Contract
564
571
  include Barrister
565
572
 
566
- attr_accessor :idl
573
+ attr_accessor :idl, :meta
567
574
 
568
575
  # `idl` must be an Array loaded from a Barrister IDL JSON file
569
576
  #
@@ -574,6 +581,7 @@ module Barrister
574
581
  @interfaces = { }
575
582
  @structs = { }
576
583
  @enums = { }
584
+ @meta = { }
577
585
 
578
586
  idl.each do |item|
579
587
  type = item["type"]
@@ -583,6 +591,12 @@ module Barrister
583
591
  @structs[item["name"]] = item
584
592
  elsif type == "enum"
585
593
  @enums[item["name"]] = item
594
+ elsif type == "meta"
595
+ item.keys.each do |key|
596
+ if key != "type"
597
+ @meta[key] = item[key]
598
+ end
599
+ end
586
600
  end
587
601
  end
588
602
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barrister
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-11 00:00:00.000000000 Z
12
+ date: 2012-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &2153042800 !ruby/object:Gem::Requirement
16
+ requirement: &2152614800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 1.5.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153042800
24
+ version_requirements: *2152614800
25
25
  description: ! 'Barrister RPC makes it easy to expose type safe services. This module
26
26
 
27
27
  provides Ruby bindings for Barrister.