Class: Jsapi::Meta::Schema::Boundary

Inherits:
Object
  • Object
show all
Defined in:
lib/jsapi/meta/schema/boundary.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, exclusive: false) ⇒ Boundary

Returns a new instance of Boundary.



21
22
23
24
# File 'lib/jsapi/meta/schema/boundary.rb', line 21

def initialize(value, exclusive: false)
  @value = value
  @exclusive = exclusive
end

Instance Attribute Details

#valueObject (readonly)

The value of the boundary.



19
20
21
# File 'lib/jsapi/meta/schema/boundary.rb', line 19

def value
  @value
end

Class Method Details

.from(value) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/jsapi/meta/schema/boundary.rb', line 7

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.

Returns:



27
28
29
# File 'lib/jsapi/meta/schema/boundary.rb', line 27

def exclusive?
  @exclusive == true
end

#inspectObject

:nodoc:



31
32
33
# File 'lib/jsapi/meta/schema/boundary.rb', line 31

def inspect # :nodoc:
  "#<#{self.class} value: #{value}, exclusive: #{exclusive?}>"
end