Class: Eastwood::Context::HashRoute

Inherits:
Struct
  • Object
show all
Defined in:
lib/eastwood/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hashObject

Returns the value of attribute hash

Returns:

  • (Object)

    the current value of hash



25
26
27
# File 'lib/eastwood/context.rb', line 25

def hash
  @hash
end

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



25
26
27
# File 'lib/eastwood/context.rb', line 25

def key
  @key
end

Instance Method Details

#coffee_argsObject



38
39
40
# File 'lib/eastwood/context.rb', line 38

def coffee_args
  parts.join ', '
end

#coffee_nameObject



35
36
37
# File 'lib/eastwood/context.rb', line 35

def coffee_name
  "#{name}_hash"
end

#coffee_pathObject



41
42
43
# File 'lib/eastwood/context.rb', line 41

def coffee_path
  path.gsub /:(\w+)/, '#{\1}'
end

#nameObject



26
27
28
# File 'lib/eastwood/context.rb', line 26

def name
  key.to_s
end

#partsObject



29
30
31
# File 'lib/eastwood/context.rb', line 29

def parts
  hash.scan( /:(\w+)/ ).flatten.map &:to_sym
end

#pathObject



32
33
34
# File 'lib/eastwood/context.rb', line 32

def path
  hash
end