Class: Srx::Data
- Inherits:
-
XmlWrapper
- Object
- XmlWrapper
- Srx::Data
show all
- Defined in:
- lib/srx/data.rb
Overview
Defined Under Namespace
Classes: LanguageMap, LanguageRule
Constant Summary
Constants inherited
from XmlWrapper
XmlWrapper::NS
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.default ⇒ Data
28
29
30
|
# File 'lib/srx/data.rb', line 28
def default
from_file(path: File.expand_path('srx-20-sample.srx', __dir__))
end
|
.from_file(path:) ⇒ Data
34
35
36
|
# File 'lib/srx/data.rb', line 34
def from_file(path:)
File.open(path, &method(:from_io))
end
|
.from_io(io) ⇒ Data
40
41
42
|
# File 'lib/srx/data.rb', line 40
def from_io(io)
new(Nokogiri::XML.parse(io))
end
|
Instance Method Details
#cascade? ⇒ Boolean
49
50
51
|
# File 'lib/srx/data.rb', line 49
def cascade?
@cascade ||= ['cascade'] == 'yes'
end
|
57
58
59
|
# File 'lib/srx/data.rb', line 57
def include_end_formatting?
@include_end_formatting ||= include_formatting?(:end)
end
|
61
62
63
|
# File 'lib/srx/data.rb', line 61
def include_isolated_formatting?
@include_isolated_formatting ||= include_formatting?(:isolated)
end
|
53
54
55
|
# File 'lib/srx/data.rb', line 53
def include_start_formatting?
@include_start_formatting ||= include_formatting?(:start)
end
|
#language_rules ⇒ Array<LanguageRule>
66
67
68
69
70
|
# File 'lib/srx/data.rb', line 66
def language_rules
@language_rules ||=
xpath(:srx, :body, :languagerules, :languagerule)
.map { |langrule| LanguageRule.new(langrule) }
end
|
73
74
75
76
77
|
# File 'lib/srx/data.rb', line 73
def map_rules
@map_rules ||=
xpath(:srx, :body, :maprules, :languagemap)
.map { |maprule| LanguageMap.new(maprule) }
end
|
#segment_subflows? ⇒ Boolean
45
46
47
|
# File 'lib/srx/data.rb', line 45
def segment_subflows?
@segment_subflows ||= ['segmentsubflows'] == 'yes'
end
|