Introduce a context concept that provides anything extra that may be passed to a component:
A component that supports context might be implemented like:
class MyComponent
def context=(context)
@context = context
end
| require "objspace" | |
| ObjectSpace.trace_object_allocations do | |
| yield | |
| end | |
| allocations = ObjectSpace.each_object.map do |obj| | |
| next if ObjectSpace.allocation_sourcefile(obj).nil? | |
| next if ObjectSpace.allocation_sourcefile(obj) == __FILE__ |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Ansi 0 Color</key> | |
| <dict> | |
| <key>Alpha Component</key> | |
| <real>1</real> | |
| <key>Blue Component</key> | |
| <real>0.24705882370471954</real> |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Ansi 0 Color</key> | |
| <dict> | |
| <key>Alpha Component</key> | |
| <real>1</real> | |
| <key>Blue Component</key> | |
| <real>0.12941177189350128</real> |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Ansi 0 Color</key> | |
| <dict> | |
| <key>Alpha Component</key> | |
| <real>1</real> | |
| <key>Blue Component</key> | |
| <real>0.15686275064945221</real> |
| module Rescuable | |
| extend ActiveSupport::Concern | |
| class_methods do | |
| def rescue_with_empty_content? | |
| defined?(@rescue_with_empty_content) && @rescue_with_empty_content | |
| end | |
| def rescue_with_empty_content! | |
| @rescue_with_empty_content = true |
Introduce a context concept that provides anything extra that may be passed to a component:
A component that supports context might be implemented like:
class MyComponent
def context=(context)
@context = context
end
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Ansi 0 Color</key> | |
| <dict> | |
| <key>Alpha Component</key> | |
| <real>1</real> | |
| <key>Blue Component</key> | |
| <real>0.32549020648002625</real> |
| module.exports = { | |
| setupTestFrameworkScriptFile: '<rootDir>/setup.ts', | |
| roots: ['<rootDir>/src'], | |
| transform: { | |
| '^.+\\.tsx?$': 'ts-jest', | |
| }, | |
| testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$', | |
| moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], | |
| } |