shenmegui 0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/shenmegui/core.rb +6 -6
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c38ef5862647ab909f11fa11b3bf389c54932027
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: fab359c72a15195ea45d20b051e10dbd352f2259
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: d87aad2fba95e372fb42facf1ef21f770cb249f808546cb90b0c62cce8cfb7bd9cb07cd323008d5f213eed9bc0834aff02590a847f92be294051be7c2d504d20
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 7a7bbec78f76afbab4f39a0656c12bb34248cd497a245530a0bd9acafac81ed2f661b981228d146462e4582c822d1ef8bf925cb27eb3e6699c9e03a2ef82a25a
         
     | 
    
        data/lib/shenmegui/core.rb
    CHANGED
    
    | 
         @@ -38,17 +38,17 @@ module ShenmeGUI 
     | 
|
| 
       38 
38 
     | 
    
         
             
                end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
              end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
       42 
42 
     | 
    
         
             
              class << self
         
     | 
| 
       43 
43 
     | 
    
         
             
                attr_accessor :elements, :socket
         
     | 
| 
       44 
44 
     | 
    
         
             
                attr_reader :this
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
                def hook(obj)
         
     | 
| 
      
 46 
     | 
    
         
            +
                def hook(obj, target)
         
     | 
| 
       47 
47 
     | 
    
         
             
                  case obj
         
     | 
| 
       48 
48 
     | 
    
         
             
                    when String
         
     | 
| 
       49 
     | 
    
         
            -
                      HookedString.new(obj,  
     | 
| 
      
 49 
     | 
    
         
            +
                      HookedString.new(obj, target)
         
     | 
| 
       50 
50 
     | 
    
         
             
                    when Array
         
     | 
| 
       51 
     | 
    
         
            -
                      HookedArray.new(obj,  
     | 
| 
      
 51 
     | 
    
         
            +
                      HookedArray.new(obj, target)
         
     | 
| 
       52 
52 
     | 
    
         
             
                    else
         
     | 
| 
       53 
53 
     | 
    
         
             
                      obj
         
     | 
| 
       54 
54 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -58,11 +58,11 @@ module ShenmeGUI 
     | 
|
| 
       58 
58 
     | 
    
         
             
                  match_data = msg.match(/(.+?):(\d+)(?:->)?({.+?})?/)
         
     | 
| 
       59 
59 
     | 
    
         
             
                  command = match_data[1].to_sym
         
     | 
| 
       60 
60 
     | 
    
         
             
                  id = match_data[2].to_i
         
     | 
| 
      
 61 
     | 
    
         
            +
                  target = elements[id]
         
     | 
| 
       61 
62 
     | 
    
         
             
                  if match_data[3]
         
     | 
| 
       62 
63 
     | 
    
         
             
                    data = JSON.parse(match_data[3])
         
     | 
| 
       63 
     | 
    
         
            -
                    data = Hash[data.keys.collect(&:to_sym).zip(data.values.collect{|x| hook  
     | 
| 
      
 64 
     | 
    
         
            +
                    data = Hash[data.keys.collect(&:to_sym).zip(data.values.collect{|x| hook(x, target)})]
         
     | 
| 
       64 
65 
     | 
    
         
             
                  end
         
     | 
| 
       65 
     | 
    
         
            -
                  target = elements[id]
         
     | 
| 
       66 
66 
     | 
    
         
             
                  case command
         
     | 
| 
       67 
67 
     | 
    
         
             
                    when :sync
         
     | 
| 
       68 
68 
     | 
    
         
             
                      target.properties.update(data)
         
     |