Class: XCRes::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/xcres/model/section.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, items, options = {}) ⇒ Section

Initialize a new section

Parameters:

  • name (String)

    see #name

  • items (Hash)

    see #items

  • options (Hash) (defaults to: {})

    see #options



28
29
30
31
32
# File 'lib/xcres/model/section.rb', line 28

def initialize(name, items, options={})
  @name  = name
  @items = items
  @options = options
end

Instance Attribute Details

#itemsHash{String => String|Hash} (readonly)

Returns the items of the section.

Returns:

  • (Hash{String => String|Hash})

    the items of the section



10
11
12
# File 'lib/xcres/model/section.rb', line 10

def items
  @items
end

#nameString (readonly)

Returns the name / key of the section.

Returns:

  • (String)

    the name / key of the section



6
7
8
# File 'lib/xcres/model/section.rb', line 6

def name
  @name
end

#optionsHash

Returns options of the section for serialization.

Returns:

  • (Hash)

    options of the section for serialization



14
15
16
# File 'lib/xcres/model/section.rb', line 14

def options
  @options
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



34
35
36
37
38
# File 'lib/xcres/model/section.rb', line 34

def ==(other)
  self.name == other.name \
    && self.items == other.items \
    && self.options == other.options
end