Class: Briskly::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/briskly/element.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keyword, data = nil, alternatives = []) ⇒ Element

Returns a new instance of Element.

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
# File 'lib/briskly/element.rb', line 10

def initialize(keyword, data = nil, alternatives = [])
  raise ArgumentError unless keyword

  @keyword      = Briskly::Keyword.new(keyword)
  @data         = data
  @alternatives = alternatives.map { |alternative| Briskly::Keyword.new(alternative) }
end

Instance Attribute Details

#alternativesObject (readonly)

Returns the value of attribute alternatives.



8
9
10
# File 'lib/briskly/element.rb', line 8

def alternatives
  @alternatives
end

#dataObject (readonly)

Returns the value of attribute data.



6
7
8
# File 'lib/briskly/element.rb', line 6

def data
  @data
end

#keyword(internal = nil) ⇒ Object (readonly)

Returns the value of attribute keyword.



7
8
9
# File 'lib/briskly/element.rb', line 7

def keyword
  @keyword
end