modulation 0.6 → 0.7
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 +5 -5
- data/README.md +24 -0
- data/lib/modulation.rb +4 -0
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: bfae406a29f60f3ae5a7611d2202a25cc1868599f083a8b465bf85a45a417a7c
         | 
| 4 | 
            +
              data.tar.gz: 1caabf00cd4bed47694bfff8e107287244cf3f49bef02edfa7d218a8c5301706
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a6f7609ceb7d64e2c64e7be0c47bdfd8df5b5e3e528818c15cf70adf03aec9f1ff22e550359b6c5591ce080a8fdf36d2d2f6fa8d98d0ed8f4592c80bdbf4e73b
         | 
| 7 | 
            +
              data.tar.gz: acd4250f81de4a1cb15abd6c4ee6b1d777ce9e19b461271ac2207b6302e9d414d39168a9e83835be44e5fff69ce22771c42d3db98d7c25da021078da9d2c5f00
         | 
    
        data/README.md
    CHANGED
    
    | @@ -195,6 +195,30 @@ end | |
| 195 195 | 
             
            5.seq(:fib)
         | 
| 196 196 | 
             
            ```
         | 
| 197 197 |  | 
| 198 | 
            +
            ### Accessing a module from nested namespaces within itself
         | 
| 199 | 
            +
             | 
| 200 | 
            +
            The special constant `MODULE` allows you to access the containing module from
         | 
| 201 | 
            +
            nested namespaces. This lets you call methods defined in the module's root
         | 
| 202 | 
            +
            namespace, or otherwise introspect the module.
         | 
| 203 | 
            +
             | 
| 204 | 
            +
            ```ruby
         | 
| 205 | 
            +
            export :await, :MyServer
         | 
| 206 | 
            +
             | 
| 207 | 
            +
            # Await a promise-like callable
         | 
| 208 | 
            +
            def await
         | 
| 209 | 
            +
              calling_fiber = Fiber.current
         | 
| 210 | 
            +
              p = ->(v = nil) {calling_fiber.resume v}
         | 
| 211 | 
            +
              yield p
         | 
| 212 | 
            +
              Fiber.yield
         | 
| 213 | 
            +
            end
         | 
| 214 | 
            +
             | 
| 215 | 
            +
            class MyServer < SuperSecretTCPServer
         | 
| 216 | 
            +
              def async_read
         | 
| 217 | 
            +
                MODULE.await {|p| on_read {|data| p.(data)}}
         | 
| 218 | 
            +
              end
         | 
| 219 | 
            +
            end
         | 
| 220 | 
            +
            ```
         | 
| 221 | 
            +
             | 
| 198 222 | 
             
            ### Accessing the global namespace
         | 
| 199 223 |  | 
| 200 224 | 
             
            If you need to access the global namespace inside a module just prefix the 
         | 
    
        data/lib/modulation.rb
    CHANGED
    
    | @@ -78,6 +78,9 @@ class Modulation | |
| 78 78 |  | 
| 79 79 | 
             
              def self.lookup_gem(name)
         | 
| 80 80 | 
             
                spec = Gem::Specification.find_by_name(name)
         | 
| 81 | 
            +
                unless(spec.dependencies.map(&:name)).include?('modulation')
         | 
| 82 | 
            +
                  raise NameError, "Cannot import gem not based on modulation"
         | 
| 83 | 
            +
                end
         | 
| 81 84 | 
             
                fn = File.join(spec.full_require_paths, "#{name}.rb")
         | 
| 82 85 | 
             
                File.file?(fn) ? fn : nil
         | 
| 83 86 | 
             
              rescue Gem::MissingSpecError
         | 
| @@ -138,6 +141,7 @@ class Modulation | |
| 138 141 | 
             
                  m.extend(ModuleMethods)
         | 
| 139 142 | 
             
                  m.metaclass.include(ModuleMetaclassMethods)
         | 
| 140 143 | 
             
                  m.__export_default_block = export_default_block
         | 
| 144 | 
            +
                  m.metaclass.const_set(:MODULE, m)
         | 
| 141 145 | 
             
                end
         | 
| 142 146 | 
             
              end
         | 
| 143 147 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: modulation
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: '0. | 
| 4 | 
            +
              version: '0.7'
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Sharon Rosner
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018-07- | 
| 11 | 
            +
            date: 2018-07-29 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies: []
         | 
| 13 13 | 
             
            description: "Modulation provides an alternative way to organize Ruby code. Instead
         | 
| 14 14 | 
             
              of \nlittering the global namespace with classes and modules, Modulation lets\nyou
         | 
| @@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 51 51 | 
             
                  version: '0'
         | 
| 52 52 | 
             
            requirements: []
         | 
| 53 53 | 
             
            rubyforge_project: 
         | 
| 54 | 
            -
            rubygems_version: 2. | 
| 54 | 
            +
            rubygems_version: 2.7.3
         | 
| 55 55 | 
             
            signing_key: 
         | 
| 56 56 | 
             
            specification_version: 4
         | 
| 57 57 | 
             
            summary: 'Modulation: explicit dependencies for Ruby'
         |