Class: Jsapi::Meta::Schema::Boundary
- Inherits:
-
Object
- Object
- Jsapi::Meta::Schema::Boundary
- Defined in:
- lib/jsapi/meta/schema/boundary.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
The value of the boundary.
Class Method Summary collapse
-
.from(value) ⇒ Object
Transforms
valueto an instance of this class.
Instance Method Summary collapse
-
#exclusive? ⇒ Boolean
Returns true if the boundary is exclusive, false otherwise.
-
#initialize(value, exclusive: false) ⇒ Boundary
constructor
A new instance of Boundary.
-
#inspect ⇒ Object
:nodoc:.
Constructor Details
#initialize(value, exclusive: false) ⇒ Boundary
Returns a new instance of Boundary.
22 23 24 25 |
# File 'lib/jsapi/meta/schema/boundary.rb', line 22 def initialize(value, exclusive: false) @value = value @exclusive = exclusive end |
Instance Attribute Details
#value ⇒ Object (readonly)
The value of the boundary.
20 21 22 |
# File 'lib/jsapi/meta/schema/boundary.rb', line 20 def value @value end |
Class Method Details
.from(value) ⇒ Object
Transforms value to an instance of this class.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/jsapi/meta/schema/boundary.rb', line 8 def self.from(value) case value when Boundary value when Hash Boundary.new(value[:value], exclusive: value[:exclusive] == true) else Boundary.new(value) end end |
Instance Method Details
#exclusive? ⇒ Boolean
Returns true if the boundary is exclusive, false otherwise.
28 29 30 |
# File 'lib/jsapi/meta/schema/boundary.rb', line 28 def exclusive? @exclusive == true end |
#inspect ⇒ Object
:nodoc:
32 33 34 |
# File 'lib/jsapi/meta/schema/boundary.rb', line 32 def inspect # :nodoc: "#<#{self.class} value: #{value}, exclusive: #{exclusive?}>" end |