Module: Namaste::Mixin

Included in:
Dir, Dir
Defined in:
lib/namaste/mixin.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

define shortcut methods for dublin kernel values



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/namaste/mixin.rb', line 4

def self.included(base)
  Namaste::DUBLIN_KERNEL.each do |k,v|
    base.class_eval do
      define_method(k.to_s) do |*args|
        namaste[k]
      end
  
      define_method(k.to_s+'=') do |v|
        namaste[k] = v
      end
    end
  end
end

Instance Method Details

#dirtypeStruct::Dirtype

If a Namaste ‘type’ tag is defined, provide structured data

Returns:

  • (Struct::Dirtype)


26
27
28
29
# File 'lib/namaste/mixin.rb', line 26

def dirtype
  type = namaste[:type]
  type.first.dirtype unless type.empty?
end

#namasteNamaste::Set

Get the set of namaste tags for this directory

Returns:



20
21
22
# File 'lib/namaste/mixin.rb', line 20

def namaste 
  @namaste ||= Namaste::Set.new(self)
end