Class: Ro::Node::Asset

Inherits:
String
  • Object
show all
Defined in:
lib/ro/node.rb

Constant Summary collapse

IMAGE_RE =
%r/[.](jpg|jpeg|png|gif|tif|tiff)$/i

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Asset

Returns a new instance of Asset.



117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/ro/node.rb', line 117

def initialize(name, options = {})
  super(name)
ensure
  options = Map.for(options)

  Asset.fattrs.each do |attr|
    if options.has_key?(attr)
      value = options[attr]
      send(attr, value)
    end
  end
end

Instance Method Details

#image?Boolean

Returns:

  • (Boolean)


136
137
138
# File 'lib/ro/node.rb', line 136

def image?
  !!(self =~ IMAGE_RE)
end

#nameObject



130
131
132
# File 'lib/ro/node.rb', line 130

def name
  self
end