Class: Lutaml::Model::Schema::XmlCompiler::Restriction
- Inherits:
-
Object
- Object
- Lutaml::Model::Schema::XmlCompiler::Restriction
- Defined in:
- lib/lutaml/model/schema/xml_compiler/restriction.rb
Constant Summary collapse
- MIN_MAX_BOUNDS =
ERB.new(<<~TEMPLATE, trim_mode: "-") <%= "\#{indent}options[:max] = \#{max_inclusive || max_exclusive}" if max_bound_exist? %> <%= "\#{indent}options[:min] = \#{min_inclusive || min_exclusive}" if min_bound_exist? %> TEMPLATE
- PATTERN =
ERB.new(<<~TEMPLATE, trim_mode: "-") <%= "\#{indent}options[:pattern] = %r{\#{pattern}}" %> TEMPLATE
- ENUMERATIONS =
ERB.new(<<~TEMPLATE, trim_mode: "-") <%= "\#{indent}options[:values] = [\#{casted_enumerations}]" %> TEMPLATE
- TRANSFORM =
ERB.new(<<~TEMPLATE, trim_mode: "-") <%= "\#{indent}value = \#{transform}" %> TEMPLATE
Instance Attribute Summary collapse
-
#base_class ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
-
#enumerations ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
-
#length ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
-
#max_exclusive ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
-
#max_inclusive ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
-
#max_length ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
-
#min_exclusive ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
-
#min_inclusive ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
-
#min_length ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
-
#pattern ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
-
#transform ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
Instance Method Summary collapse
Instance Attribute Details
#base_class ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
9 10 11 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 9 def base_class @base_class end |
#enumerations ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
9 10 11 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 9 def enumerations @enumerations end |
#length ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
9 10 11 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 9 def length @length end |
#max_exclusive ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
9 10 11 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 9 def max_exclusive @max_exclusive end |
#max_inclusive ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
9 10 11 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 9 def max_inclusive @max_inclusive end |
#max_length ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
9 10 11 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 9 def max_length @max_length end |
#min_exclusive ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
9 10 11 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 9 def min_exclusive @min_exclusive end |
#min_inclusive ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
9 10 11 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 9 def min_inclusive @min_inclusive end |
#min_length ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
9 10 11 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 9 def min_length @min_length end |
#pattern ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
9 10 11 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 9 def pattern @pattern end |
#transform ⇒ Object
transform is not a ‘xsd’ type, but it is used for internal purposes.
9 10 11 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 9 def transform @transform end |
Instance Method Details
#required_files ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 47 def required_files if base_class_name == :decimal "require \"bigdecimal\"" elsif !SimpleType::SUPPORTED_DATA_TYPES.dig(base_class_name, :skippable) "require_relative \"#{Utils.snake_case(base_class_name)}\"" end end |
#to_method_body(indent = nil) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/lutaml/model/schema/xml_compiler/restriction.rb', line 38 def to_method_body(indent = nil) [ value_for(ENUMERATIONS, type: :enumerations, indent: indent), value_for(MIN_MAX_BOUNDS, type: :min_max_bounds, indent: indent), value_for(PATTERN, type: :pattern, indent: indent), value_for(TRANSFORM, type: :transform, indent: indent), ].compact.join end |