Class: Sway::Base

Inherits:
Object
  • Object
show all
Includes:
Mashable
Defined in:
lib/sway/base.rb

Direct Known Subclasses

CSV, File, JSON, YAML

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mashable

#create_mash_from, #create_mashes_from

Constructor Details

#initialize(array_or_hash) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
14
15
16
17
# File 'lib/sway/base.rb', line 8

def initialize(array_or_hash)
  case array_or_hash.class.to_s
  when 'Array'
    array = array_or_hash
    @mashes = create_mashes_from(array)
  when 'Hash'
    hash = array_or_hash
    @mash = create_mash_from(hash)
  end
end

Instance Attribute Details

#mashObject (readonly)

Returns the value of attribute mash.



6
7
8
# File 'lib/sway/base.rb', line 6

def mash
  @mash
end

#mashesObject (readonly)

Returns the value of attribute mashes.



6
7
8
# File 'lib/sway/base.rb', line 6

def mashes
  @mashes
end