Class: Turbo::PathConfiguration
- Inherits:
-
Object
- Object
- Turbo::PathConfiguration
- Defined in:
- lib/turbo/path_configuration/path_configuration.rb
Instance Attribute Summary collapse
-
#delegate ⇒ Object
Returns the value of attribute delegate.
-
#loader ⇒ Object
Returns the value of attribute loader.
-
#rules ⇒ Object
Returns the value of attribute rules.
-
#settings ⇒ Object
Returns the value of attribute settings.
-
#sources ⇒ Object
Returns the value of attribute sources.
Instance Method Summary collapse
-
#initWithSources(sources) ⇒ Object
Multiple sources will be loaded in order Remote sources should be last since they’re loaded async.
-
#propertiesForPath(path) ⇒ Object
Returns a merged hash containing all the properties that match this path.
-
#propertiesForURL(url) ⇒ Object
Returns a merged hash containing all the properties that match this url Note: currently only looks at path, not query, but most likely will add query support in the future, so it’s best to always use this over the path variant unless you’re sure you’ll never need to reference other parts of the URL in the future.
Instance Attribute Details
#delegate ⇒ Object
Returns the value of attribute delegate.
4 5 6 |
# File 'lib/turbo/path_configuration/path_configuration.rb', line 4 def delegate @delegate end |
#loader ⇒ Object
Returns the value of attribute loader.
4 5 6 |
# File 'lib/turbo/path_configuration/path_configuration.rb', line 4 def loader @loader end |
#rules ⇒ Object
Returns the value of attribute rules.
4 5 6 |
# File 'lib/turbo/path_configuration/path_configuration.rb', line 4 def rules @rules end |
#settings ⇒ Object
Returns the value of attribute settings.
4 5 6 |
# File 'lib/turbo/path_configuration/path_configuration.rb', line 4 def settings @settings end |
#sources ⇒ Object
Returns the value of attribute sources.
4 5 6 |
# File 'lib/turbo/path_configuration/path_configuration.rb', line 4 def sources @sources end |
Instance Method Details
#initWithSources(sources) ⇒ Object
Multiple sources will be loaded in order Remote sources should be last since they’re loaded async
7 8 9 10 11 12 |
# File 'lib/turbo/path_configuration/path_configuration.rb', line 7 def initWithSources(sources) self.sources = sources self.rules = [] load self end |
#propertiesForPath(path) ⇒ Object
Returns a merged hash containing all the properties that match this path
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/turbo/path_configuration/path_configuration.rb', line 25 def propertiesForPath(path) #source = NSString.stringWithContentsOfURL(url, encoding: NSUTF8StringEncoding, error: nil) properties = {} rules.each do |rule| if rule.match(path) properties.merge!(rule.properties) end end properties end |
#propertiesForURL(url) ⇒ Object
Returns a merged hash containing all the properties that match this url Note: currently only looks at path, not query, but most likely will add query support in the future, so it’s best to always use this over the path variant unless you’re sure you’ll never need to reference other parts of the URL in the future
19 20 21 |
# File 'lib/turbo/path_configuration/path_configuration.rb', line 19 def propertiesForURL(url) propertiesForPath(url.path) end |