Class: RiceBubble::Attributes::Literal

Inherits:
Base
  • Object
show all
Defined in:
lib/rice_bubble/attributes/literal.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#call, #fetch, #optional, #valid_types

Constructor Details

#initialize(literal) ⇒ Literal

Returns a new instance of Literal.



6
7
8
9
# File 'lib/rice_bubble/attributes/literal.rb', line 6

def initialize(literal, &)
  super(&)
  @literal = literal
end

Instance Attribute Details

#literalObject (readonly)

Returns the value of attribute literal.



4
5
6
# File 'lib/rice_bubble/attributes/literal.rb', line 4

def literal
  @literal
end

Instance Method Details

#descriptionObject



15
16
17
# File 'lib/rice_bubble/attributes/literal.rb', line 15

def description
  literal.inspect
end

#valid?(value) ⇒ Boolean

Returns:



11
12
13
# File 'lib/rice_bubble/attributes/literal.rb', line 11

def valid?(value)
  value == literal
end