Class: Boxxspring::Property

Inherits:
Base
  • Object
show all
Defined in:
lib/boxxspring/resources/property.rb

Instance Method Summary collapse

Methods inherited from Base

field, has_many, has_one, inherited, #initialize

Constructor Details

This class inherits a constructor from Boxxspring::Base

Instance Method Details

#operation(path) ⇒ Object



46
47
48
# File 'lib/boxxspring/resources/property.rb', line 46

def operation( path )
  Boxxspring::Operation.new( File.join( '/properties', self.id.to_s, path ) )
end

#settings_content_by_name(name, default_result = nil) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/boxxspring/resources/property.rb', line 33

def settings_content_by_name( name, default_result = nil )
  setting = self.settings.detect { | setting | setting.name == name }
  result = setting.nil? ? default_result : setting.content 

  # convert the result to boolean when boolean
  result = true if result =~ ( /(true)$/i )
  result = false if result =~ ( /(false)$/i )

  result 
end