Class: Prosereflect::Schema::MarkSpec
- Inherits:
-
Object
- Object
- Prosereflect::Schema::MarkSpec
- Defined in:
- lib/prosereflect/schema/spec.rb
Overview
Represents a mark specification from a schema
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
-
#excludes ⇒ Object
readonly
Returns the value of attribute excludes.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#inclusive ⇒ Object
readonly
Returns the value of attribute inclusive.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, attrs: {}, excludes: nil, inclusive: true, group: nil) ⇒ MarkSpec
constructor
A new instance of MarkSpec.
Constructor Details
#initialize(name:, attrs: {}, excludes: nil, inclusive: true, group: nil) ⇒ MarkSpec
Returns a new instance of MarkSpec.
44 45 46 47 48 49 50 51 |
# File 'lib/prosereflect/schema/spec.rb', line 44 def initialize(name:, attrs: {}, excludes: nil, inclusive: true, group: nil) @name = name @attrs = attrs @excludes = excludes @inclusive = inclusive @group = group end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
42 43 44 |
# File 'lib/prosereflect/schema/spec.rb', line 42 def attrs @attrs end |
#excludes ⇒ Object (readonly)
Returns the value of attribute excludes.
42 43 44 |
# File 'lib/prosereflect/schema/spec.rb', line 42 def excludes @excludes end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
42 43 44 |
# File 'lib/prosereflect/schema/spec.rb', line 42 def group @group end |
#inclusive ⇒ Object (readonly)
Returns the value of attribute inclusive.
42 43 44 |
# File 'lib/prosereflect/schema/spec.rb', line 42 def inclusive @inclusive end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
42 43 44 |
# File 'lib/prosereflect/schema/spec.rb', line 42 def name @name end |
Class Method Details
.from_hash(name, spec) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/prosereflect/schema/spec.rb', line 53 def self.from_hash(name, spec) new( name: name, attrs: spec[:attrs] || spec["attrs"] || {}, excludes: spec[:excludes] || spec["excludes"], inclusive: if spec.key?(:inclusive) spec[:inclusive] elsif spec.key?("inclusive") spec["inclusive"] else true end, group: spec[:group] || spec["group"], ) end |