glug 0.0.8 → 0.0.9
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/glug/layer.rb +5 -3
- data/lib/glug/stylesheet.rb +9 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bebac26dd70c1755650c029aba0ae0d5031018f167d4638c0c362595a6f7622d
|
4
|
+
data.tar.gz: 1d3ca7e158a4cef60d8d2934aea595bc1c5e570382ab71768c067a58082e3f94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7be8a1cb44b2ae801708166f4df56daa62b1874d8276e607b9504ac513ed50d312222c9f18c33eee53097d11247e7e4ff706f22c9397cbd6198bddba6909354d
|
7
|
+
data.tar.gz: 7d494d4030edca1328173d1b5f9e025df08350faaf4a23ee428c6897a802a977612b806ec36010461028d073236c668817113e77e0ef651d56e557744561232d
|
data/lib/glug/layer.rb
CHANGED
@@ -76,8 +76,10 @@ module Glug # :nodoc:
|
|
76
76
|
# If we can match it to a GL property, it's an assignment:
|
77
77
|
# otherwise it's an OSM key
|
78
78
|
def method_missing(method_sym, *arguments)
|
79
|
-
if
|
80
|
-
|
79
|
+
if @stylesheet.extensions.include?(method_sym)
|
80
|
+
self.instance_exec(*arguments, &@stylesheet.extensions[method_sym])
|
81
|
+
elsif EXPRESSIONS.include?(method_sym)
|
82
|
+
Condition.new.from_list(method_sym, arguments)
|
81
83
|
elsif LAYOUT.include?(method_sym) || PAINT.include?(method_sym) || TOP_LEVEL.include?(method_sym)
|
82
84
|
v = arguments.length==1 ? arguments[0] : arguments
|
83
85
|
if v.is_a?(Proc) then v=v.call(@kv[method_sym]) end
|
@@ -87,7 +89,7 @@ module Glug # :nodoc:
|
|
87
89
|
_add_cascade_condition(method_sym, v)
|
88
90
|
end
|
89
91
|
else
|
90
|
-
|
92
|
+
Condition.new.from_list("get", [method_sym])
|
91
93
|
end
|
92
94
|
end
|
93
95
|
|
data/lib/glug/stylesheet.rb
CHANGED
@@ -4,13 +4,14 @@ module Glug # :nodoc:
|
|
4
4
|
# the main document object
|
5
5
|
|
6
6
|
class Stylesheet
|
7
|
-
attr_accessor :sources, :kv, :refs, :base_dir, :params
|
7
|
+
attr_accessor :sources, :kv, :refs, :base_dir, :params, :extensions
|
8
8
|
|
9
9
|
def initialize(base_dir: nil, params: nil, &block)
|
10
10
|
@sources = {}
|
11
11
|
@kv = {}
|
12
12
|
@layers = []
|
13
13
|
@refs = {}
|
14
|
+
@extensions = {}
|
14
15
|
@base_dir = base_dir || ''
|
15
16
|
@params = params || {}
|
16
17
|
instance_eval(&block)
|
@@ -18,9 +19,14 @@ module Glug # :nodoc:
|
|
18
19
|
|
19
20
|
# Set a property, e.g. 'bearing 29'
|
20
21
|
def method_missing(method_sym, *arguments)
|
21
|
-
|
22
|
+
arg = arguments[0]
|
23
|
+
if arg.is_a?(Proc)
|
24
|
+
@extensions[method_sym] = arg
|
25
|
+
else
|
26
|
+
@kv[method_sym] = arguments[0]
|
27
|
+
end
|
22
28
|
end
|
23
|
-
|
29
|
+
|
24
30
|
# Add a source
|
25
31
|
def source(source_name, opts={})
|
26
32
|
@sources[source_name] = opts
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Fairhurst
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: neatjson
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: Text-based markup for Mapbox GL styles
|
55
|
+
description: Text-based markup for Mapbox/Maplibre GL styles
|
56
56
|
email: richard@systemeD.net
|
57
57
|
executables:
|
58
58
|
- glug
|