Class: CabezaDeTermo::JsonSpec::IsScalarExpectation

Inherits:
Expectation show all
Defined in:
lib/cabeza-de-termo/json-spec/expectations/is-scalar-expectation.rb

Instance Method Summary collapse

Methods inherited from Expectation

#accept_walker, #expectation_method, #explain, #explain_parameters, #failed_message_block, #failed_message_on, #json_spec, #set_expectation_method, #set_json_spec

Methods inherited from AbstractExpectation

#accept_walker, #explain, #failed_message_on, #set_expectation_method, #set_json_spec

Instance Method Details

#is_satisfied_by?(value_holder) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/cabeza-de-termo/json-spec/expectations/is-scalar-expectation.rb', line 6

def is_satisfied_by?(value_holder)
	is_scalar?(value_holder)
end

#is_scalar?(value_holder) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
# File 'lib/cabeza-de-termo/json-spec/expectations/is-scalar-expectation.rb', line 10

def is_scalar?(value_holder)
	[::String, ::Numeric, ::TrueClass, ::FalseClass, ::NilClass].any? do |type|
		value_holder.value.kind_of?(type)
	end
end