Skip to content

Commit 7b5c04f

Browse files
committed
implements function for converting xpath to css
1 parent ed61430 commit 7b5c04f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

app/models/document.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,19 @@ def custom_uniqueness_check
6666
errors.add(:url, "A document for this URL already exists! Inspect it here: #{go_to_doc}")
6767
end
6868

69+
def convert_xpath_to_css
70+
runner = NodeRunner.new(
71+
<<~JAVASCRIPT
72+
const xPathToCss = require('xpath-to-css')
73+
const convert = (xpath) => {
74+
const css = xPathToCss(xpath)
75+
return css;
76+
}
77+
JAVASCRIPT
78+
)
79+
runner.convert xpath
80+
end
81+
6982
def fetch_ota_text
7083
versions = %w[pga-versions contrib-versions]
7184
service_name = service.name

0 commit comments

Comments
 (0)